sip.conf extensions.conf of Asterisk for the full-demo-app

623 views
Skip to first unread message

limche...@gmail.com

unread,
Aug 23, 2016, 1:23:39 AM8/23/16
to SIP.js
Hi,
I am new to sip.js and Asterisk. I really like the demo of <http://sipjs.com/guides/full-demo-app/>. I have tried to copy the page and made my own version, but it does not success. Is there any where I can download or have a look at the configurations of Asterisk(11.11.0), such as sip.conf, extensions.conf, or maybe other related, to make the demo success.
Sorry, that I might repeat a question that has already been asked by someone.
Thank you.

James Criscuolo

unread,
Aug 23, 2016, 9:43:16 AM8/23/16
to SIP.js, limche...@gmail.com
Hi limcheepheng,
  Have you seen our Asterisk configuration guide? It sounds like just what you are looking for.

James

CheePheng Lim

unread,
Aug 25, 2016, 2:14:19 AM8/25/16
to James Criscuolo, SIP.js
Hi,
I am still struggling, if someone has experience, please help. Thank you.
Below are my environment and configurations.

Asterisk(11.11.0) installed on CentOS 7 on 192.168.179.4
sip.conf
=======================================
[general]
transport=udp,ws
rtcachefriends=yes
allowguest=yes
limitonpeers=yes
callcounter=yes
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
udpbindaddr=192.168.179.4       ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
;externhost=set_your_externhost_here
externrefresh=150
localnet=192.168.179.4/255.255.255.0
disallow=all
allow=gsm
allow=ulaw                     ; Allow codecs in order of preference
allow=alaw                     ; Allow codecs in order of preference
videosupport=yes
allow=speex
allow=vp8
textsupport=yes
language=en                    ; Default language setting for all users/peers
callcounter=yes
limitonpeers=yes
callevents=yes
realm=192.168.179.4
;nat=force_rport,comedia

;Instant message
accept_outofcall_message=yes
outofcall_message_context=message ;
auth_message_requests=no

[1060] ; alice
;there is another block of [1060] before [1061], similar to [1061] except the username only
;

[1061] ;  bob
type=friend
username=1061 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
disallow=all
allow=ulaw
allow=alaw
dtmf=auto
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=udp,ws ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when

[1062]
type=friend
username=1062
host=dynamic
secret=password
context=default
qualify=no
canreinvite=yes
textsupport=yes

[1063]
type=friend
username=1063
host=dynamic
secret=password
context=default
qualify=no
canreinvite=yes
textsupport=yes


extensions.conf
=======================================
[default]
exten => 1060,1,Dial(SIP/1060) ; Dialing 1060 will call the SIP client registered to 1060
exten => 1060,n,Hangup()
exten => 1061,1,Dial(SIP/1061) ;
exten => 1061,n,Hangup()
exten => 1062,1,Dial(SIP/1062)
exten => 1062,n,Hangup()
exten => 1063,1,Dial(SIP/1063)
exten => 1063,n,Hangup()

[message]
exten => 1062,1,MessageSend(sip:${EXTEN},”${CALLERID(name)}”${MESSAGE(from)})
exten => 1063,1,MessageSend(sip:${EXTEN},”${CALLERID(name)}”${MESSAGE(from)})

=======================================
xlite and zoiper are installed on pc 192.168.179.3.

1062 is xlite, 1063 is zoiper.  1062 can voice call to 1063 and vice versa.

=======================================
At Apache on pc 192.168.179.3

I make use of the example on page <http://sipjs.com/>. This example is really amazing.
In my own version of "sipjs_demo.js", below are the related part that I changed to suit my environment.

function createUA(callerURI, displayName) {
    var configuration = {
        traceSip: true,
        uri: callerURI,
        displayName: displayName,
        username:displayName,
        password: 'password'
    };
    var userAgent = new SIP.UA(configuration);
    return userAgent;
}

var domain = '192.168.179.4';
var aliceURI      = '1060' + '@' + domain;
var aliceName     = '1060';

var bobURI        = '1061' + '@' + domain;
var bobName       = '1061';

window.aliceUA = createUA(aliceURI, aliceName);
window.bobUA   = createUA(bobURI, bobName);

aliceUA.on('registered', markAsRegistered);
aliceUA.on('registrationFailed', failRegistration);


The markAsRegistered and failRegistration are never being called.

Can anyone help? Thanks in advance.


CheePheng Lim

unread,
Aug 25, 2016, 5:11:34 AM8/25/16
to James Criscuolo, SIP.js
Hi,
I do a few updates to the code in "sipjs_demo.js", and now it "seems" that I can make call from 1062 to 1060(alice, webrtc).
Below are the changes:


function createUA(callerURI, displayName) {
    var configuration = {
        traceSip: true,
        register: true,
        uri: 'sip:'+callerURI,
        displayName: displayName,
        authorizationUser: displayName,
        password: 'password',
        hackIpInContact: true,
        wsServers: ['ws://192.168.179.4:8088/ws']

    };
       
    var userAgent = new SIP.UA(configuration);
    return userAgent;
}

....

    var aliceUA;
    var bobUA;
   
// not using window.aliceUA = createUA(aliceURI, aliceName);
    aliceUA = createUA(aliceURI, aliceName);
    bobUA   = createUA(bobURI, bobName);

==============================================
Now I can audio call from 1062 (X-Lite softphone, to 1060(Alice on webrtc, Firefox)). Alice gets the incoming and popup requests for audio access permission.

var options = mediaOptions(true, false, remoteRender, null);

And I click "ok" (to permit).
It "seems" that channel is being established, from CLI asterisk. But I can not judge whether is there any voice actually between Web browser to softphone, because both of them are on the same pc.

Please advise if any idea to verify. TIA.


Reply all
Reply to author
Forward
0 new messages