SOLVED Enabling SIP URI Dialing / Breaks Outbound DISA

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
Any outbound number called through the disa, is converted to a local/internal sip call.
 

Dr. Kupka

New Member
Joined
Jul 3, 2013
Messages
22
Reaction score
7
Code:
"MyDomain="

From http://nerdvittles.com/?p=27781:

The first line should display the MyDomain variable. If it is empty or doesn’t match the SIPDOMAIN entry, the outbound call will fail. To fix it, add an entry to the Asterisk database from the Asterisk CLI using syntax like the following: database put MyDomain FQDN 10.0.0.11 or database put MyDomain FQDN sip.me.com where 10.0.0.11 or sip.me.com matches the SIPDOMAIN entry shown on the second line. Then retry your outbound call, and it should complete successfully.
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
@drkupka @wardmundy Please read the title. Using DISA to place outbound calls, after calling in fail, even after correcting the MYDOMAIN, outbound DISA are intercepted as sip url calls, instead of being placed as a outbound call using the outbound route
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,229
@trupsalms: Thanks for catching it. There was a double-bug that blocked some internal calls including DISA. Not only were DISA calls treated as SIP URI calls but, fixing that, meant the DISA extension itself got treated as an outbound call when, in fact, it was internal.

We've fixed both bugs now by testing the length of the dial string if it's not a SIP URI call. If the string is greater than 5 digits, it's processed as an outbound call. With 5 digits or less, we handle it as an internal extension. Some of our international friends may need to change the number of digits to treat as an internal vs. external call.

Simply repeat the install steps from the tutorial, and all should be well.

Code:
cd /tmp
wget http://incrediblepbx.com/sipuri-mod.tar.gz
tar zxvf sipuri-mod.tar.gz
rm -f sipuri-mod.tar.gz
./install-sip-uri-mod.sh
 
Last edited:

Dr. Kupka

New Member
Joined
Jul 3, 2013
Messages
22
Reaction score
7
The following works for me at least with DISA + click-to-dial + speeddials on IncrediblePBX / Asterisk 11.25.1 / FreePBX 2.11.0.43.

No idea if generic enough...

Code:
[ext-local-custom]
exten => _.,1,NoOp(SIPCALLID: ${SIPCALLID})
exten => _.,n,NoOp(SIPDOMAIN: ${SIPDOMAIN})
exten => _.,n,NoOp(EXTEN: ${EXTEN})
exten => _.,n,Set(URI=${SHELL(echo ${EXTEN} | grep @ | awk -F "@" '{ print $(NF) }'):0:-1})
; from this debugging I got:

; 1. softphone:
;    call: 380306 (german local number)
;       [email protected]
;       SIPDOMAIN: 192.168.88.120
;       EXTEN: 380306
;       URI:
;
;   call: [email protected]
;       [email protected]
;       SIPDOMAIN: sip2sip.info
;       EXTEN: 2233435945
;       URI:

; 2. click-to-dial:
;   call: 380306
;       [email protected]:5060
;       SIPDOMAIN:
;       EXTEN: 380306
;       URI:
;
;   call: [email protected]
;       [email protected]:5060
;       SIPDOMAIN:
;       EXTEN: [email protected]
;       URI: sip2sip.info

; 3. speeddial:
;   call: 0123456789
;       SIPCALLID=3264821342@192_168_88_108
;       SIPDOMAIN: 192.168.88.120
;       EXTEN: 0123456789
;       URI:
;
;   call: [email protected]
;       SIPCALLID=311316250@192_168_88_108
;       SIPDOMAIN: 192.168.88.120
;       EXTEN: [email protected]
;       URI: sip2sip.info

; if IP is used
exten => _.,n,Set(MyDomain=${SHELL(hostname -I | sed -e 's/[^[0-9][.]//g' | awk -F " " '{ print $1 }'):0:-1})

; NOT a SIP-URI-call, if:
;    ${SIPDOMAIN} = ${MyDomain} AND ${URI} is empty
;        OR
;   ${SIPDOMAIN} AND ${URI} are empty

exten => _.,n,GotoIf($["${MyDomain}" = "${SIPDOMAIN}" && "${URI}" = ""]?OutAllRoutes
exten => _.,n,GotoIf($["${SIPDOMAIN}" = "" && "${URI}" = ""]?OutAllRoutes

; if FQDN is used
exten => _.,n,Set(MyDomain=${SHELL(hostname | awk -F " " '{ print $1 }'):0:-1})

exten => _.,n,GotoIf($["${MyDomain}" = "${SIPDOMAIN}" && "${URI}" = ""]?OutAllRoutes
exten => _.,n,GotoIf($["${SIPDOMAIN}" = "" && "${URI}" = ""]?OutAllRoutes

exten => _.,n,ExecIf($["${URI}" != ""]?Macro(uridial,${EXTEN})
exten => _.,n,ExecIf($["${URI}" = ""]?Macro(uridial,${EXTEN}@${SIPDOMAIN})

exten => _.,n(OutAllRoutes),Goto(outbound-allroutes,${EXTEN},1)
 
Last edited:

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
;# // BEGIN SIP URI Mod1.0
; Portions of the following code are Copyright (c) 2019, Ward Mundy & Associates LLC
; Licensed for use pursuant to GPL2: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
exten => _.,1,Set(MyDomain=${CUT(SIPCALLID,@,2)})
exten => _.,n,NoOp(SIPDOMAIN: ${SIPDOMAIN})
exten => _.,n,GotoIf($["foo${MyDomain}" != "foo"]?FoundDomain)
exten => _.,n,Set(MyDomain=${DB(MyDomain/FQDN)})
exten => _.,n(FoundDomain),GotoIf($["${MyDomain}" = "${SIPDOMAIN}"]?OutAllRoutes)
exten => _.,n,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _.,n(OutAllRoutes),Goto(outbound-allroutes,${EXTEN},1)
;# // END SIP URI Mod1.0

;# // BEGIN SIP URI Mod1.1
; Portions of the following code are Copyright (c) 2019, Ward Mundy & Associates LLC
; Licensed for use pursuant to GPL2: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
exten => _.,1,Set(MyDomain=${CUT(SIPCALLID,@,2)})
exten => _.,n,NoOp(SIPDOMAIN: ${SIPDOMAIN})
exten => _.,n,GotoIf($["foo${MyDomain}" != "foo"]?FoundDomain)
exten => _.,n,Set(MyDomain=${DB(MyDomain/FQDN)})
exten => _.,n,Set(SIPDOMAIN=${DB(MyDomain/FQDN)})
exten => _.,n(FoundDomain),GotoIf($["${MyDomain}" = "${SIPDOMAIN}"]?OutAllRoutes)
exten => _.,n,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _.,n(OutAllRoutes),Set(DSTRING=${LEN(${EXTEN})})
exten => _.,n,ExecIf($["${DSTRING}" > "5"]?Goto(outbound-allroutes,${EXTEN},1)
exten => _.,n,Dial(local/${EXTEN}@from-internal-additional)
;# // END SIP URI Mod1.1
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,229
Be careful changing the BEGIN SIP URI Mod1 label. It may break the ability to automatically load future versions with a simple reinstall.
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
Just a thought on enabling SIP URI calling. Including this in the general dial plan is a little problematic because of security concerns of having it in [ext-local-custom] and problems like this DISA issue.

SIP URI calling only needs to be exposed to people you trust as well as phones that can do it. Why not make a custom context such as [from-internal-with-sipuri] and only put extensions (phones) you trust into that context. As part of it, include [from-internal] so that they can use all the usual internal dialplan, plus also SIP URI dialing.

Here's another fun security problem with SIP URI dialing. Let's say you use Flowroute.com for your trunking and have disabled international calling using PBX outbound routes. Someone with SIP URI dialing could easily get around that by using a SIP URI like [email protected]. That call will go through because your PBX is permitted to send calls to flowroute.
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
@wardmundy: Thanks First: Tested both versions, Mod1.0 allows for sip url calls to be placed, but blocks disa calls, & Mod1.1 allows for disa calls to be place, but blocks the sip url calls.

With in these four lines, that my small test have came up with, by placing a ;, or swapping ;, set MyDomain or set SIPDOMAIN:
exten => _.,n,GotoIf($["foo${MyDomain}" != "foo"]?FoundDomain)
exten => _.,n,Set(MyDomain=${DB(MyDomain/FQDN)})
exten => _.,n,Set(SIPDOMAIN=${DB(MyDomain/FQDN)})
exten => _.,n(FoundDomain),GotoIf($["${MyDomain}" = "${SIPDOMAIN}"]?OutAllRoutes)
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,229
@billsimon: I've only tested this with FreePBX 13, not pure Asterisk platforms. Security issue #1 was addressed by moving the code to [from-internal-custom] which requires a SIP registration to execute. I think this also addresses the Flowroute SIP URI example because it would require BOTH a registered extension AND a registered trunk connection to Flowroute. Same issue would be present with providers such as V1VoIP and voip.ms as well.

@trupsalms: I can't reproduce your issue with SIP URI outbound calls. Mine still work fine with the new code. For example, calls to Lenny at
[email protected] still go through.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,229
@wardmundy: again thanks, for some reason, my test calls to [email protected], does work, however calls to other sip address fail. Example: weather, news, etc @demo.nerdvittles.com and [email protected]. Please see asterisk cli log for call: https://pastebin.com/p9fZu836

If one SIP URI works, then it's not a problem with the SIP URI code. It's a problem elsewhere. Perhaps your IP address is blocked. PM your IP address to me, and I can at least check our server.
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
If one SIP URI works, then it's not a problem with the SIP URI code. It's a problem elsewhere. Perhaps your IP address is blocked. PM your IP address to me, and I can at least check our server.

Also with the very first code, you made, i was able to call all the @demo.nerdvittles.com extensions., I'm posting the asterisk CLI as it might sheed some light on the issue.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,229
As I said, I can't reproduce the issue. All of my SIP URI outbound calls work. Are you running Incredible PBX 13-13 on CentOS 6 platform??

Try commenting out the following line and see if that helps. Not sure it won't break something else. :)

Code:
exten => _.,n,Set(SIPDOMAIN=${DB(MyDomain/FQDN)})
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
As I said, I can't reproduce the issue. All of my SIP URI outbound calls work. Are you running Incredible PBX 13-13 on CentOS 6 platform??

Try commenting out the following line and see if that helps. Not sure it won't break something else. :)

Code:
exten => _.,n,Set(SIPDOMAIN=${DB(MyDomain/FQDN)})

Yes I am running Incredible PBX 13-13 on CentOS 6 platform!!!

I've pastebin my extension_custom.conf, maybe a clue in it.
 

Members online

Forum statistics

Threads
25,825
Messages
167,856
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top