TrixBox SIP Peer and it's extension - centos

I am totally new to this PBX, I really don't know what is it and I wanna learn it ASAP, I've created an SIP peer and an SIP user, in Extensions.conf I need the code to route all outbound calls to that SIP Peer (which is a gsm gateway of GoIP). Here're my files
Extensions.conf :
[goip]
exten => 1,1,Wait(1)
exten => 1,n,Answer
exten => 1,n,Playback(hello-world)
exten => 1,n,Wait(2)
exten => 1,n,Hangup
User Configuration in Sip_additional.conf:
[400]
deny=0.0.0.0/0.0.0.0
type=friend
secret=aneestech01
qualify=yes
port=5060
pickupgroup=
permit=0.0.0.0/0.0.0.0
nat=yes
mailbox=400#default
host=dynamic
dtmfmode=rfc2833
dial=SIP/400
context=from-internal
canreinvite=no
callgroup=
callerid=device <400>
accountcode=
call-limit=50
Peer Configuration in SIP.conf:
[gsm1]
canreinvite=no
context=goip
dtmfmode=rfc2833
fromuser=gsm1
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g729
insecure=port,invite
secret=gsm1
type=friend
defaultname=gsm1
Please note that both my GSM Gateway and My SIP client are connected to the asterisk pbx successfully, The thing I request now is that whenever I dial a number from sip client, it should be dialed from the gsm gateway, if you need any kind of additional info please post a comment and you'll get a reply soon

You need context like:
[from-internal]
exten => _X.,1,Dial(SIP/gsm1,,)
But i highly recomend you read some book for beginners like "asterisk the future of telephony"

Guys This worked for me:
[from-internal]
exten => _X.,1,Dial(SIP/gsm1/${EXTEN})

Related

Issue on SIPML5 plugin integration on AWS with Asterisks server- 13 using WebRTC

I have faced an issue on integrating the demo of SIPML5 plugin on the Asterisks server. The Asterisks server version is "Asterisk 13.14.0". The new version of the asterisks server supports SRTP module.
The plugin demo files are taken from Doubango's github repository. The demo integration files are placed on the root folder of our AWS server account.
Ref: https://github.com/DoubangoTelecom/sipml5/
The contents of the different configuration files for Asterisks server are as follows:
http.conf
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
tlsenable=yes
tlsbindaddr=0.0.0.0:8089
tlscertfile=/etc/asterisk/keys/asterisk.pem
tlsprivatekey=/etc/asterisk/keys/asterisk.pem
rtp.conf
[general]
rtpstart=10000
rtpend=20000
icesupport=yes
stunaddr=stun.l.google.com:19302
extensions.conf
[default]
exten => 100,1,Dial(SIP/1060)
exten => 101,1,Dial(SIP/1061)
exten => 102,1,Playback(1-for-am-2-for-pm)
exten => 205,1,Answer
exten => 205,2,Wait(2)
exten => 205,3,Record(asterisk-recording%d:ulaw)
exten => 205,4,Wait(2)
exten => 205,5,Playback(${RECORDED_FILE})
exten => 205,6,Wait(2)
exten => 205,7,Hangup
[from-internal]
exten => 1000,1,Answer()
same => n,Playback(demo-congrats)
same => n,Hangup()
sip.conf
[general]
udpbindaddr=0.0.0.0:5060
realm=x.x.x.x ;replace with your Asterisk server public IP address or host
transport=udp,ws,wss
externaddr=x.x.x.x ;replace with your Server's Public IP Address
websocket_enabled=true
[6001]
host=dynamic
secret=****
context=from-internal
type=friend
encryption=yes
avpf=yes
force_avp=yes
icesupport=yes
directmedia=no
disallow=all
allow=ulaw
dtlsenable=yes
dtlsverify=fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtlssetup=actpass
The filed values set for the expert.htm page for the demo is as follows:-
WebSocket Server URL : wss://X.X.X.X:8088/ws
SIP outbound Proxy URL: udp://X.X.X.X:5060
ICE servers: [{ url: ‘stun:stun.l.google.com:19302’}]
The filed values set for the call.htm page for the demo is as follows:-
Display name: Rusty WEBRTC
Private identity: 6001
Public identity: sip:6001#X.X.X.X
Password; ****
Realm: X.X.X.X
Where X.X.X.X is my Asterisks server IP.
When click on the "Log in" button on the call.htm page an error message is displayed like
Disconnected: Failed to connect to the server
The linphone plugin is installed on the project right now. Due to the withdrawal of NPAPI support by Chrome/Mozilla browsers, the VoIP feature is completely outdated on the project. Now I want to replace the feature with SipML5 plugin which supports the WebRTC protocol. I need to check the registration, login, audio call features of the SIPML5 plugin. But all these functionalities can be implemented once i got connected to the server.
The Asterisks CLI is not displayed any error message. The console history of Chrome and Mozilla browsers are not displayed any vulnerable error messages. So I'm completely stuck on the project.
The demo files were worked fine on the Asterisks 11.8.1 server. But the SRTP module was not installed on the server so that the audio feature was not worked fine. Our supporting team is installed the library now and reinstalled the asterisks server with version 13. The firewall is open for the AWS server and the ports are open now.
Can anybody help me to fix the issue so that i can go further with the plug in integration to my project.Please let me know if any other details needed
SipML5 client will try to connect the server over Secure WebSocket URL(WSS).
So u need to use port 8089(tls) in WSS url.
If you using Self signed SSL certifactes in http.conf, allow them by opening https://X.X.X.X:8089/ws url in browser tab.
Possible debugging steps:
1. Check if asterisk is actually listening on 8089. You can use netstat for that.
2. If you are loading your client/browser in https mode then you need to trust your client on asterisk. This can be done through: http://X.X.X.X:8089/httpstatus and select trust.

Setup TLS + ZRTP For VOIP Using Asterisk and CSipSimple

Im trying to setup voip exchange using asterisk ans CSipSimple as client, fol are the detials
Server Side:
Generate certificates for server and two clients
Place the server cert in /etc/asterisk/keys/
sip.conf:
[general]
context=local
allowguest=no
alwaysauthreject=yes
allow=gsm
allow=ulaw
allow=alaw
directmedia=yes
allowoverlap=no
bindport=5061
tlsdontverifyserver=yes
tlsenable=yes
tlsbindaddr=192.168.0.119
tlscertfile=/etc/asterisk/keys/asterisk.pem
tlscafile=/etc/asterisk/keys/ca.crt
tlscapath=/etc/asterisk/keys
register => tls://john:password#192.168.0.119:5061
register => tls://jane:password#192.168.0.119:5061
tlscipher=ALL
tlsclientmethod=tlsv1
localnet=192.168.0.119/255.255.255.0
[john]
type=peer
defaultuser=john
secret=password
dtmfmode=rfc2833
callerid="User one"
host=dynamic
canreinvite=no
nat=no
encryption=yes
transport=tls
[jane]
type=peer
defaultuser=jane
secret=password
dtmfmode=rfc2833
callerid="User two"
host=dynamic
canreinvite=no
nat=no
encryption=yes
transport=tls
Client Side:
setup the TLS setting in OSTN account
udp enabled tcp enabled
srtp disabled
zrtp create zrtp
codes => GSM,ulaw,alw
Problem
TLS +zRTP displayed and the call is made
instead on the asterisk CLI i see a messsage,
WARNING[5008][C-00000034]: chan_sip.c:10433 process_sdp: Matched
device setup to use SRTP, but request was not!
im using android 4.2.2 asterisk 1.8, if i make srtp mandatory and zRTP => create zrtp the call is made indicating TLS to the immediate hop + srtp
How can i achieve TLS +ZRTP on asterisk using CSipSimple as client.
Regards.
ZRTP is a protocol for end-to-end devices encryption and this cannot be achieved with the standard unmodified Asterisk since it is basically designed as a server not as a proxy (which is what you need in order to achieve zrtp forwarding). However, The Zfgone project has released some patches for Asterisk to support it. The implementation is quite a challenge since some problems may occurs on the go (for example, sound distortion caused by some codecs) due some bugs on asterisk and it also implies some feature limitations (like not being able to transfer or put a call on hold). But you can use SRTP (it also encrypts traffic but only between server and client)
If you want to use zrtp, I will recommend you to use a kamailio sip server.

Asterisk outgoing call fails

I have Asterisk 11.7.0 configured on CentOS 6.4 x64 with following sip.conf configuration:
[general]
register =>mynumber:mypass#xxx.xxx.xxx.xxx
registertimeout=20
context=incoming
allowoverlap=no
bindport=5060
bindaddr=192.168.0.3
srvlookup=no
subscribecontext=from-sip
; The SIP provider
[VoIPProvider]
canreinvite=no
username=mynumber
fromuser=mynumber
secret=mypass
context=incoming
type=friend
fromdomain=xxx.xxx.xxx.xxx
;host=xxx.xxx.xxx.xxx
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes
insecure=very
; ext 100
[100]
type=friend
host=dynamic
secret=MyPass123
context=internal
mailbox=100#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 200
[200]
type=friend
host=dynamic
secret=MyPass123
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
And following extensions.conf:
[incoming]
; Ring on extension 100, 200 and the mobile phone.
exten => s,1,Answer()
exten => s,n,Dial(SIP/100&SIP/200&SIP/VoIPProvider/*320423456789,150,r,t,)
; Pass unanswered call to a mobile phone
exten => s,n,Dial(SIP/VoIPProvider/*320423456789,150,r)
; Still not answered? Pass unanswered calls to voicemail
exten => s,n,Voicemail(100,u)
exten => s,n,Hangup
[outgoing]
exten => _XXXXXXXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
[internal]
exten => _XXX,1,Dial(SIP/${EXTEN})
; Calls to ext 100
exten => 100,1,Dial(SIP/100,20)
exten => 100,n,VoiceMail(100,u)
exten => 100,n,Hangup
; Calls to ext 200
exten => 200,1,Dial(SIP/100,20)
exten => 200,n,Hangup
When I try to dial my mobile number from an IP phone I see following output in Asterisk CLI:
-- Executing [XXXXXXXXX#outgoing:1] Dial("SIP/XXX-00000002", "SIP/VoIPProvider/XXXXXXXXX") in new stack
WARNING[19884][C-00000003]: app_dial.c:2437 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
== Everyone is busy/congested at this time (1:0/0/1)
-- Auto fallthrough, channel 'SIP/XXX-00000002' status is 'CHANUNAVAIL'
Now, I know what cause 20 - Subscriber absent means, but I know for sure that my mobile number exists and is reachable, because when I dial the IP Phone's number from my mobile (incoming call) it works.
Any suggestions?
I can't see how the VoIPProvider entry can be used for an outgoing call since it has no "host" field and therefore Asterisk will not know where the SIP call should be sent.
Try creating a new entry in your sip.conf called "VoIPProvider_Outgoing" or similar and uncomment the host field. Then in your extensions.conf replace "VoIPProvider" with "VoIPProvider_Outgoing".
Please add the your outgoing context in your dialling user context.
like under internal:
include = outgoing
or
include=outgoing
it means same in Asterisk

Incoming calls fail Asterisk

I have Asterisk 11.7.0 configured on CentOS 6.4 x64 with following sip.conf configuration:
[general]
register =>mynumber:mypass#xxx.xxx.xxx.xxx
registertimeout=20
context=incoming
allowoverlap=no
bindport=5060
bindaddr=192.168.0.3
srvlookup=no
subscribecontext=from-sip
; The SIP provider
[VoIPProvider]
canreinvite=no
username=mynumber
fromuser=mynumber
secret=mypass
context=incoming
type=friend
fromdomain=xxx.xxx.xxx.xxx
host=xxx.xxx.xxx.xxx
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes
insecure=very
; ext 100
[100]
type=friend
host=dynamic
secret=MyPass123
context=internal
mailbox=100#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 200
[200]
type=friend
host=dynamic
secret=MyPass123
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
And following extensions.conf:
[incoming]
; Ring on extension 100, 200 and the mobile phone.
exten => s,1,Answer()
exten => s,n,Dial(SIP/100&SIP/200&SIP/VoIPProvider/*320423456789,150,r,t,)
; Pass unanswered call to a mobile phone
exten => s,n,Dial(SIP/VoIPProvider/*320423456789,150,r)
; Still not answered? Pass unanswered calls to voicemail
exten => s,n,Voicemail(100,u)
exten => s,n,Hangup
[outgoing]
exten => _XXXXXXXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
[internal]
exten => _XXX,1,Dial(SIP/${EXTEN})
; Calls to ext 100
exten => 100,1,Dial(SIP/100,20)
exten => 100,n,VoiceMail(100,u)
exten => 100,n,Hangup
; Calls to ext 200
exten => 200,1,Dial(SIP/100,20)
exten => 200,n,Hangup
Whenever I dial my number from mobile phone I get a rejection signal. When I check the wireshark log i see three SIP packets:
MySipProvider -> Me: INVITE sip:s#192.168.0.3:5060
Me -> MySipProvider: 401 Unauthorized
MySipProvider -> Me: ACK sip:s#192.168.0.3:5060
and that's all there is. What could be happening? Thank you.
Looks like your Asterisk server is requesting authentication on the incoming call from your provider. My guess as to why is because the "host" value on your "VoIPProvider" entry in your sip.conf matches the IP address the call came from. You could check if this is the problem by temporarily commenting out the "host" value and seeing if the incoming call works. If so you will need to make adjustments to the "VoIPProvider" entry so it gets matched for outgoing calls only rather than incoming and outgoing (you used to do this by setting the "type" but I'm not up to date on the way it's done now).
to solve outgoing problem you user context in internal and outgoing is not included in it please add the following line under context internal in extension.conf
[internal]
include = outgoing
so that your users can dial at SIP trunk. :)
use register string as this:
register => urusername:urpassword#IPaddress/providername
like in your case:
register => mynumber:mypassword#X.X.X.X/VoIPProvider
give it a go ithink this will solve the issue :)

Asterisk configuration for getting Notify to the BLF

i am trying to configure Asterisk server to get NOTIFICATION for BLF.
I get NOTYFY for the SUBSCRIBE at the time of REGISTER but at the time of Running call for the busy user ,no NOTIFY is sent from the Asterisk server.
The Sip.conf File setting is as below:
[1111]
type=friend
username=1111
secret=1111
context=dialplan
host=dynamic
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
transport=udp
qualify=no
dtmfmode=inband
encryption=no
nat=no
mailbox=11#voicemail
subscribecontext=BLF
call-limit=20
[2222]
type=friend
username=2222
secret=2222
context=dialplan
host=dynamic
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
transport=udp
qualify=no
dtmfmode=inband
encryption=no
nat=no
and the Extensions.conf file is as below:
[BLF]
exten => 1111,hint,SIP/1111
exten => 2222,hint,SIP/2222
exten => 3333,hint,SIP/3333
In the Above setting, i need Notification For user 2222 on User 1111.
Pls help.
To subscribe to multiple extensions, one have to concatenate those with "&":
exten => 1111,hint,SIP/1111&SIP/2222
If you also want to pickup calls, you have to put those extensions in the same pickup group.
You can visit the asterisk commandline interface (CLI)
$ asterisk -rvvvv
to debug subcriptions
*CLI> core show hints
*CLI> sip show subscriptions
*CLI> core show hints