VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
kctrey at gmail.com Guest
|
Posted: Fri Mar 18, 2016 10:21 am Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
I am trying to set up my Asterisk server so that it will recognize an incoming call to the Asterisk's own Location Routing Number (LRN), validating the "rn" in the INVITE and then using the Called Number from the INVITE as the extension in the dialplan.
The INVITE R-URI looks like:
INVITE sip:+19135041291;rn=+19136630000;npdi@12.4.240.200:5060;user=phone;transport=udp SIP/2.0
The +1913663000 is the LRN of the Asterisk box, so I would want to have the dialplan validate that the "rn" is that number. The +19136631291 is the extension within the system that they are trying to reach, that extension will vary, and will have an exten defined in the dialplan.
I assume that this is just going to require that I do some matching and substring-type variable replacement to hit a context with just the Called Number part of the request, but I wondered if anyone had a working example of this before I started putting too much effort into it.
As a PBX, Asterisk doesn't have to worry about portability, but I am using it to simulate a full-blown Class 5 switch, so I have to have an LRN assigned to it to allow users to port to that switch.
-Trey |
|
Back to top |
|
|
admin at tootai.net Guest
|
Posted: Fri Mar 18, 2016 10:49 am Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
Le 18/03/2016 16:20, Trey Hilyard a écrit :
Quote: | I am trying to set up my Asterisk server so that it will recognize an
incoming call to the Asterisk's own Location Routing Number (LRN),
validating the "rn" in the INVITE and then using the Called Number from
the INVITE as the extension in the dialplan.
The INVITE R-URI looks like:
INVITE
sip:+19135041291;rn=+19136630000;npdi@12.4.240.200:5060;user=phone;transport=udp
SIP/2.0
The +1913663000 is the LRN of the Asterisk box, so I would want to have
the dialplan validate that the "rn" is that number. The +19136631291 is
the extension within the system that they are trying to reach, that
extension will vary, and will have an exten defined in the dialplan.
I assume that this is just going to require that I do some matching and
substring-type variable replacement to hit a context with just the
Called Number part of the request, but I wondered if anyone had a
working example of this before I started putting too much effort into it.
|
Use the SIP_HEADER function
http://www.voip-info.org/wiki/view/Asterisk+func+sip_header
--
Daniel
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
kctrey at gmail.com Guest
|
Posted: Fri Mar 18, 2016 10:58 am Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
On Fri, Mar 18, 2016 at 10:49 AM Administrator TOOTAI <admin@tootai.net (admin@tootai.net)> wrote:
Quote: | Le 18/03/2016 16:20, Trey Hilyard a écrit :
Quote: | I am trying to set up my Asterisk server so that it will recognize an
incoming call to the Asterisk's own Location Routing Number (LRN),
validating the "rn" in the INVITE and then using the Called Number from
the INVITE as the extension in the dialplan.
The INVITE R-URI looks like:
INVITE
sip:+19135041291;rn=+19136630000;npdi@12.4.240.200 ([email]19136630000%3Bnpdi@12.4.240.200[/email]):5060;user=phone;transport=udp
SIP/2.0
The +1913663000 is the LRN of the Asterisk box, so I would want to have
the dialplan validate that the "rn" is that number. The +19136631291 is
the extension within the system that they are trying to reach, that
extension will vary, and will have an exten defined in the dialplan.
I assume that this is just going to require that I do some matching and
substring-type variable replacement to hit a context with just the
Called Number part of the request, but I wondered if anyone had a
working example of this before I started putting too much effort into it.
|
Use the SIP_HEADER function
http://www.voip-info.org/wiki/view/Asterisk+func+sip_header |
I am not sure that this is needed here. The Request URI has all of the values that I need. I agree that I might need to CUT part of the R-URI, but I don't need access to any other header to find the info I need.
When the call arrives at the Asterisk right now, this is the exten/context that it is hitting, so it already has the info I need:
Executing [9135041291;rn=+19136630000;npdi@from_pstn:1]
As far as I can tell, I think that I just need to figure out how to make an extension entry that matches on the "rn=+19136630000\;npdi" and then moves to another context (or same one) with ${EXTEN,0,10}.
I just can't get that first extension to match on the RN value.
Â
|
|
Back to top |
|
|
kctrey at gmail.com Guest
|
Posted: Fri Mar 18, 2016 3:20 pm Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
I thought this would be as easy as
exten => _XXXXXXXXXX\;rn=+19136630000,1,Goto(from_pstn,${EXTEN:0:10})
But it appears that the pattern match doesn't work once I get to the "r" in "rn". I am assuming that the pattern match doesn't like dealing with characters without taking the entire URI.
I am working on a plan using a lot more CUTs than I think I should need, but we'll see if it works.
On Fri, Mar 18, 2016 at 10:58 AM Trey Hilyard <kctrey@gmail.com (kctrey@gmail.com)> wrote:
Quote: | On Fri, Mar 18, 2016 at 10:49 AM Administrator TOOTAI <admin@tootai.net (admin@tootai.net)> wrote:
Quote: | Le 18/03/2016 16:20, Trey Hilyard a écrit :
Quote: | I am trying to set up my Asterisk server so that it will recognize an
incoming call to the Asterisk's own Location Routing Number (LRN),
validating the "rn" in the INVITE and then using the Called Number from
the INVITE as the extension in the dialplan.
The INVITE R-URI looks like:
INVITE
sip:+19135041291;rn=+19136630000;npdi@12.4.240.200 ([email]19136630000%3Bnpdi@12.4.240.200[/email]):5060;user=phone;transport=udp
SIP/2.0
The +1913663000 is the LRN of the Asterisk box, so I would want to have
the dialplan validate that the "rn" is that number. The +19136631291 is
the extension within the system that they are trying to reach, that
extension will vary, and will have an exten defined in the dialplan.
I assume that this is just going to require that I do some matching and
substring-type variable replacement to hit a context with just the
Called Number part of the request, but I wondered if anyone had a
working example of this before I started putting too much effort into it.
|
Use the SIP_HEADER function
http://www.voip-info.org/wiki/view/Asterisk+func+sip_header |
I am not sure that this is needed here. The Request URI has all of the values that I need. I agree that I might need to CUT part of the R-URI, but I don't need access to any other header to find the info I need.
When the call arrives at the Asterisk right now, this is the exten/context that it is hitting, so it already has the info I need:
Executing [9135041291;rn=+19136630000;npdi@from_pstn:1]
As far as I can tell, I think that I just need to figure out how to make an extension entry that matches on the "rn=+19136630000\;npdi" and then moves to another context (or same one) with ${EXTEN,0,10}.
I just can't get that first extension to match on the RN value.
Â
|
|
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Fri Mar 18, 2016 8:27 pm Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
Quote: | On Fri, 18 Mar 2016, Trey Hilyard wrote:
Quote: | I thought this would be as easy as
exten => _XXXXXXXXXX\;rn=+19136630000,1,Goto(from_pstn,${EXTEN:0:10})
|
|
How about something like:
[parse-lrn]
exten = _x.,1, verbose(1,[${EXTEN}@${CONTEXT}])
same = n, set(DID=${CUT(EXTEN,\;,1)})
same = n, set(LRN=${CUT(EXTEN,\;,2):3:12})
same = n, execif($["${LRN:0:1}" = "+"]?set(LRN=${LRN:1}))
same = n, execif($["${LRN:0:1}" = "1"]?set(LRN=${LRN:1}))
same = n, goto(${LRN},${DID},1)
same = n, hangup()
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
kctrey at gmail.com Guest
|
Posted: Sun Mar 20, 2016 7:12 am Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
On Mar 18, 2016 8:27 PM, "Steve Edwards" <asterisk.org@sedwards.com (asterisk.org@sedwards.com)> wrote:
Quote: | Quote: |
On Fri, 18 Mar 2016, Trey Hilyard wrote:
Quote: | I thought this would be as easy as
exten => _XXXXXXXXXX\;rn=+19136630000,1,Goto(from_pstn,${EXTEN:0:10})
|
|
How about something like:
[parse-lrn]
    exten = _x.,1,         verbose(1,[${EXTEN}@${CONTEXT}])
    same = n,            set(DID=${CUT(EXTEN,\;,1)})
    same = n,            set(LRN=${CUT(EXTEN,\;,2):3:12})
    same = n,            execif($["${LRN:0:1}" = "+"]?set(LRN=${LRN:1}))
    same = n,            execif($["${LRN:0:1}" = "1"]?set(LRN=${LRN:1}))
    same = n,            goto(${LRN},${DID},1)
    same = n,            hangup()
| That's a good one. One thing it doesn't do is actually validate that the LRN is mine, but that shouldn't be tough to add now the the LRN is in its own variable. Thanks for the help!
|
|
Back to top |
|
|
asterisk.org at sedwar... Guest
|
Posted: Sun Mar 20, 2016 12:43 pm Post subject: [asterisk-users] Incoming INVITE with Portability Info and L |
|
|
On Sun, 20 Mar 2016, Trey Hilyard wrote:
Quote: | On Mar 18, 2016 8:27 PM, "Steve Edwards" <asterisk.org@sedwards.com> wrote:
Quote: | Quote: |
On Fri, 18 Mar 2016, Trey Hilyard wrote:
Quote: | I thought this would be as easy as
exten => _XXXXXXXXXX\;rn=+19136630000,1,Goto(from_pstn,${EXTEN:0:10})
|
|
How about something like:
[parse-lrn]
    exten = _x.,1,         verbose(1,[${EXTEN}@${CONTEXT}])
    same = n,            set(DID=${CUT(EXTEN,\;,1)})
    same = n,            set(LRN=${CUT(EXTEN,\;,2):3:12})
    same = n,            execif($["${LRN:0:1}" = "+"]?set(LRN=${LRN:1}))
    same = n,            execif($["${LRN:0:1}" = "1"]?set(LRN=${LRN:1}))
    same = n,            goto(${LRN},${DID},1)
    same = n,            hangup()
|
That's a good one. One thing it doesn't do is actually validate that the
LRN is mine, but that shouldn't be tough to add now the the LRN is in
its own variable. Thanks for the help!
|
If the LRN is not yours, you will not have a matching context so the
goto() will run the invalid handler (the 'i' extension). You could play an
appropriate message there.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards@sedwards.com Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|