Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Incoming INVITE with Portability Info and LRN


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
kctrey at gmail.com
Guest





PostPosted: Fri Mar 18, 2016 10:21 am    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with 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.


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





PostPosted: Fri Mar 18, 2016 10:49 am    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with 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: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





PostPosted: Fri Mar 18, 2016 10:58 am    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with 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.


 
Quote:


--
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





PostPosted: Fri Mar 18, 2016 3:20 pm    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with quote

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.




 
Quote:


--
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
asterisk.org at sedwar...
Guest





PostPosted: Fri Mar 18, 2016 3:36 pm    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with 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})

Have you tried the '_!.' pattern?

--
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
asterisk.org at sedwar...
Guest





PostPosted: Fri Mar 18, 2016 7:58 pm    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with quote

On Fri, 18 Mar 2016, Steve Edwards wrote:

Quote:
Have you tried the '_!.' pattern?

The '_x.' pattern works fine.

--
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
asterisk.org at sedwar...
Guest





PostPosted: Fri Mar 18, 2016 8:27 pm    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with 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()

--
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





PostPosted: Sun Mar 20, 2016 7:12 am    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with quote

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!
Quote:

--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards@sedwards.com (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
asterisk.org at sedwar...
Guest





PostPosted: Sun Mar 20, 2016 12:43 pm    Post subject: [asterisk-users] Incoming INVITE with Portability Info and L Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

VoiceMeUp - Corporate & Wholesale VoIP Services