Two Sip Extensions
I have two SIP extensions defined in sip.conf
register => 4450@10.20.1.1/4450
[4450]
type=friend usernameD50
host.20.1.1
allow=all dtmfmode=inband context=incoming
register => 4451@10.20.1.1/4451
[4451]
type=friend usernameD51
host.20.1.1
allow=all dtmfmode=inband context=incoming
Pretty straight forward… The first one works the second one does not. Then if I switch them again the first one works the second one does not.
What is happening ? Thanks,
Jerry
10 thoughts on - Two Sip Extensions
“register” lines have to be under the general section. They can’t be within a friend/peer/user.
—
Joshua C. Colp Digium – A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW – Huntsville, AL 35806 – US
Check us out at: http://www.digium.com & http://www.asterisk.org
—
Jerry,
Can you define working? Are you not able to get calls? Make calls? Also the register statements should both be on top under the general section for instance:
register => 4450@10.20.1.1/4450
register => 4451@10.20.1.1/4451
[4450]
type=friend usernameD50
host.20.1.1
allow=all dtmfmode=inband context=incoming
[4451]
type=friend usernameD51
host.20.1.1
allow=all dtmfmode=inband context=incoming
Thanks – Ok I switch to look like what you have.
register => 4450 at 10.20.1.1
<http://lists.digium.com/mailman/listinfo/asterisk-users>/4450
register => 4451 at 10.20.1.1
<http://lists.digium.com/mailman/listinfo/asterisk-users>/4451
[4450]
type=friend usernameD50
host.20.1.1
allow=all dtmfmode=inband context=incoming
[4451]
type=friend usernameD51
host.20.1.1
allow=all dtmfmode=inband context=incoming
Same thing. I can call into 4450 just fine. But I cannot call into
4451. Both are defined in extensions.conf
Both show up in the sip show peers.
4450/4450 10.20.1.1
Auto (No) No 5060 Unmonitored
4451/4451 10.20.1.1
Auto (No) No 5060 Unmonitored
Thanks,
Jerry
Only the first entry will be matched for incoming. As another individual has stated you’ll have to also clarify what doesn’t exactly work. If you enable SIP debug (sip set debug on) do you not see the INVITE coming in for example?
—
Joshua C. Colp Digium – A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW – Huntsville, AL 35806 – US
Check us out at: http://www.digium.com & http://www.asterisk.org
—
Sorry, have to also readjust to chan_sip thinking and wonkiness. The second may get matched depending on the INVITE. You’ll need to provide more information as I mentioned so it can be seen what exactly is happening on the calls that could differentiate them.
—
Joshua C. Colp Digium – A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW – Huntsville, AL 35806 – US
Check us out at: http://www.digium.com & http://www.asterisk.org
—
It looks like moving both to the general section got it working. Never new that was a requirement. 🙂
Thanks,
Jerry
I format my entries in sip.conf like below to keep everything related to the endpoint together.
; 4450
[general](+)
register = 4450@10.20.1.1/4450
[4450]
allow = all
context = incoming
dtmfmode = inband
host = 10.20.1.1
type = friend
username = 4450
; 4451
[general](+)
register = 4451@10.20.1.1/4451
[4451]
allow = all
context = incoming
dtmfmode = inband
host = 10.20.1.1
type = friend
username = 4451
I like to keep the parameters in each stanza sorted and ‘tabbed out’ to make it easier to compare stanzas and because I’m just that kind of guy 🙂
—
Thanks in advance,
————————————————————————-
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
—
Thanks Steve,
I was not aware of the (+) format… basically “add” to the general section.
How far back does that go? T o 1.4.X ?
Is there a documentation piece on that ?
Jerry
There’s a section on the wiki[1] which talks about the various aspects of the configuration parser and how to do things in the configuration files. Templates are also very handy[2].
[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Configuration+Files
[2] https://wiki.asterisk.org/wiki/display/AST/Using+Templates
—
Joshua C. Colp Digium – A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW – Huntsville, AL 35806 – US
Check us out at: http://www.digium.com & http://www.asterisk.org
—
I don’t know, but I checked a sip.conf from 1.2 (2012ish?) and I was using it then.
I’m sure there is, I just don’t know where 🙂
Another cool configuration file feature is templates (an exclamation mark instead of a plus sign). It lets you define common ‘snippets’ once and include them in each context as needed.
Here’s an example from that same (1.2 based) project:
; templates
[digit-timeout](!)
exten = t,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = t,n, goto(${CONTEXT},s,1)
[h](!)
exten = h,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = h,n, goto(settle-card,s,1)
[i](!)
exten = i,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = i,n, goto(${CONTEXT},s,1)
[s](!)
exten = s,1, verbose(1,[${EXTEN}@${CONTEXT}])
[max-timeout](!)
exten = T,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = T,n, goto(max-time,s,1)
[x](!)
exten = _x.,1, verbose(1,[${EXTEN}@${CONTEXT}])
; authorized the card
[auth-card](h,i,s,max-timeout,digit-timeout)
exten = s,2, agi(write-cdr)
exten = s,n, set(PRODUCT=${CONTEXT})
exten = s,n, set(PER-MINUTE=0)
exten = s,n, set(PREAMBLE=${CUSTOMER}/menu/m1101)
exten = s,n, agi(auth-card,${AUTH-FLAGS},${DEBUG-MODE},${VERBOSE-MODE})
exten = s,n, goto(theme,s,1)
The templates are inserted into the auth-card context when the file is parsed. I don’t have a 1.2 host running anymore, but a ‘show dialplan auth-card’ (1.2) would look something like:
[auth-card](h,i,s,max-timeout,digit-timeout)
exten = T,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = T,n, goto(max-time,s,1)
exten = h,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = h,n, goto(settle-card,s,1)
exten = i,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = i,n, goto(${CONTEXT},s,1)
exten = s,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = s,2, agi(write-cdr)
exten = s,n, set(PRODUCT=${CONTEXT})
exten = s,n, set(PER-MINUTE=0)
exten = s,n, set(PREAMBLE=${CUSTOMER}/menu/m1101)
exten = s,n, agi(auth-card,${AUTH-FLAGS},${DEBUG-MODE},${VERBOSE-MODE})
exten = s,n, goto(theme,s,1)
exten = t,1, verbose(1,[${EXTEN}@${CONTEXT}])
exten = t,n, goto(${CONTEXT},s,1)
Templates are also useful in other configuration files like sip.conf to define ‘classes’ of parameters like ‘dial-in-agent’ or ‘supervisor’ that can be included in endpoint definitions to reduce clutter, increase consistency, and reduce maintenance.
—
Thanks in advance,
————————————————————————-
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
—