Workshop

Uit Limesco Wiki
Ga naar: navigatie, zoeken

SIP registration

Add to sip.conf:

[sipphone]
type=friend
host=dynamic
context=from-sipphone
secret=geheim
insecure=invite

Add to extensions.conf:

[from-sipphone]
; Here will be the dialplan rules that are relevant
; when we call a number from the SIP phone.
exten => 1234,1,Answer
exten => 1234,n,Wait(1)
exten => 1234,n,Playback(demo-thanks)
exten => 1234,n,Hangup

Open your Asterisk console using asterisk -vvvR (may need to run as root), then:

yourpbx*CLI> sip reload
yourpbx*CLI> dialplan reload
yourpbx*CLI> sip show peers
Name/username      Host               Dyn Forcerport ACL Port     Status     
sipphone/sipphone  (Unspecified)      D   N              0        Unmonitored

Now, configure your phone to connect to your Asterisk instance (over UDP). Watch your Asterisk log. When it connects, you will see a message. If it doesn't, use sip set debug on to find out whether you're receiving INVITE messages and see their contents.

As soon as the SIP phone is connected, call 1234 on it. You will hear a thank-you message from Asterisk.

Calling smbp

The rules in your dialplan (Answer, Wait, Playback, Hangup) are applications. There are many applications that you can use during a call. To get a list of applications, open your Asterisk CLI and run:

yourpbx*CLI> core show applications

One of the applications is called Dial. You use it to forward the call to other channels, for example SIP channels. The top of sip.conf explains how to use Dial to call SIP channels. Hint: the extension rule starts with exten => 1234,n,Dial(SIP/...

smbp's IP address is 192.168.178.172. Call the extension "1234" on it to receive the same message. Don't forget to reload your dialplan after changing it using dialplan reload.

Calling PSTN

smbp can forward to the public network if you authenticate to it. Claim one of the numbers on the slide. Then, add a line like this to your sip.conf below [general]:

register => NUMBER:PASSWORD@192.168.178.172

For example:

register => 31632271690:foobar@192.168.178.172

Then, tell me the password you chose and I will make sure you can connect.