VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
torbjorn.abrahamsson a... Guest
|
Posted: Tue Feb 18, 2014 4:38 am Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
Hello…
I have a problem where I would like to be able to send an arbitrary SIP domain when sending a call to a registered friend. By default the from domain is set to the IP of the Asterisk server, but I would like to set it to something else.
The case is that when a call from a foreign domain comes in to the Asterisk, it will connect it to the callee (but with the domain changed). When the callee wants to make a redial from call history, the domain will not be correct.
I could probably do something with the fromdomain setting of the friend, but I would like it to be dynamic, ie not having to update the friend definition every time a different domain is used.
I understand that I would need to use outbound proxy in the client to prevent it from dialing the domain directly.
Is this possible? Any alternatives?
BR,
Torbjörn Abrahamsson |
|
Back to top |
|
|
rnewton at digium.com Guest
|
Posted: Wed Feb 19, 2014 11:31 am Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
Actually SIPFROMDOMAIN was documented here:
https://wiki.asterisk.org/wiki/display/AST/chan_sip+Channel+Variables
, but SIPFROMUSER was not. They are now both there! :)
On Wed, Feb 19, 2014 at 9:08 AM, Rusty Newton <rnewton@digium.com> wrote:
Quote: | On Tue, Feb 18, 2014 at 3:40 AM, Torbjörn Abrahamsson
<torbjorn.abrahamsson@gmail.com> wrote:
Quote: | I have a problem where I would like to be able to send an arbitrary SIP
domain when sending a call to a registered friend. By default the from
domain is set to the IP of the Asterisk server, but I would like to set it
to something else.
The case is that when a call from a foreign domain comes in to the Asterisk,
it will connect it to the callee (but with the domain changed). When the
callee wants to make a redial from call history, the domain will not be
correct.
I could probably do something with the fromdomain setting of the friend, but
I would like it to be dynamic, ie not having to update the friend definition
every time a different domain is used.
I understand that I would need to use outbound proxy in the client to
prevent it from dialing the domain directly.
Is this possible? Any alternatives?
|
I'm a little confused about what you want to do, however I'll throw
some information at you in hopes that it will help out.
I did a little research and found that you can set the outbound From
header domain and From header user through two channel variables:
SIPFROMDOMAIN, SIPFROMUSER
They are sparsely documented, but there is an example in extensions.conf
same => n(from),Set(__SIPFROMUSER=${CALLERID(num)})
same => n,GotoIf($["${GLOBAL(FREENUMDOMAIN)}" = ""]?dial)
; check if we set the FREENUMDOMAIN global variable in [global]
same => n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)})
; if we did set it, then we'll use it for our outbound dialing
domain
It looks like they were added in 1.6.2.X of Asterisk, so if you are
using 1.8.X or above, you should have them.
On your inbound call, you could use the function SIP_HEADER[1] to
gather the domain and store it for later use when you want to set it
on the outbound call. Though I'm not sure how you could tell that the
call was a redial.
[1]: https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Function_SIP_HEADER
I'm assuming when your SIP client redials that it calls through
Asterisk and is not dialing the previously caller directly.
Hope any of that helps. *Goes off to document SIPFROMDOMAIN and
SIPFROMUSER on the wiki*
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
|
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- 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 |
|
|
rnewton at digium.com Guest
|
Posted: Wed Feb 19, 2014 11:35 am Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
On Tue, Feb 18, 2014 at 3:40 AM, Torbjörn Abrahamsson
<torbjorn.abrahamsson@gmail.com> wrote:
Quote: | I have a problem where I would like to be able to send an arbitrary SIP
domain when sending a call to a registered friend. By default the from
domain is set to the IP of the Asterisk server, but I would like to set it
to something else.
The case is that when a call from a foreign domain comes in to the Asterisk,
it will connect it to the callee (but with the domain changed). When the
callee wants to make a redial from call history, the domain will not be
correct.
I could probably do something with the fromdomain setting of the friend, but
I would like it to be dynamic, ie not having to update the friend definition
every time a different domain is used.
I understand that I would need to use outbound proxy in the client to
prevent it from dialing the domain directly.
Is this possible? Any alternatives?
|
I'm a little confused about what you want to do, however I'll throw
some information at you in hopes that it will help out.
I did a little research and found that you can set the outbound From
header domain and From header user through two channel variables:
SIPFROMDOMAIN, SIPFROMUSER
They are sparsely documented, but there is an example in extensions.conf
same => n(from),Set(__SIPFROMUSER=${CALLERID(num)})
same => n,GotoIf($["${GLOBAL(FREENUMDOMAIN)}" = ""]?dial)
; check if we set the FREENUMDOMAIN global variable in [global]
same => n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)})
; if we did set it, then we'll use it for our outbound dialing
domain
It looks like they were added in 1.6.2.X of Asterisk, so if you are
using 1.8.X or above, you should have them.
On your inbound call, you could use the function SIP_HEADER[1] to
gather the domain and store it for later use when you want to set it
on the outbound call. Though I'm not sure how you could tell that the
call was a redial.
[1]: https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Function_SIP_HEADER
I'm assuming when your SIP client redials that it calls through
Asterisk and is not dialing the previously caller directly.
Hope any of that helps. *Goes off to document SIPFROMDOMAIN and
SIPFROMUSER on the wiki*
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- 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 |
|
|
torbjorn.abrahamsson a... Guest
|
Posted: Wed Feb 19, 2014 1:13 pm Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
Thank you very much. I will try this! It seems to be what I'm looking for.
I'm in most cases working with 1.2 asterisks, so I'm not up to date on newer features. My current project however needed a newer version. I tried some googleing, but I did not find these variables.
Thanks,
Torbjörn Abrahamsson
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Rusty Newton
Sent: den 19 februari 2014 16:21
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Dynamically setting from domain when calling friends
Actually SIPFROMDOMAIN was documented here:
https://wiki.asterisk.org/wiki/display/AST/chan_sip+Channel+Variables
, but SIPFROMUSER was not. They are now both there! :)
On Wed, Feb 19, 2014 at 9:08 AM, Rusty Newton <rnewton@digium.com> wrote:
Quote: | On Tue, Feb 18, 2014 at 3:40 AM, Torbjörn Abrahamsson
<torbjorn.abrahamsson@gmail.com> wrote:
Quote: | I have a problem where I would like to be able to send an arbitrary SIP
domain when sending a call to a registered friend. By default the from
domain is set to the IP of the Asterisk server, but I would like to set it
to something else.
The case is that when a call from a foreign domain comes in to the Asterisk,
it will connect it to the callee (but with the domain changed). When the
callee wants to make a redial from call history, the domain will not be
correct.
I could probably do something with the fromdomain setting of the friend, but
I would like it to be dynamic, ie not having to update the friend definition
every time a different domain is used.
I understand that I would need to use outbound proxy in the client to
prevent it from dialing the domain directly.
Is this possible? Any alternatives?
|
I'm a little confused about what you want to do, however I'll throw
some information at you in hopes that it will help out.
I did a little research and found that you can set the outbound From
header domain and From header user through two channel variables:
SIPFROMDOMAIN, SIPFROMUSER
They are sparsely documented, but there is an example in extensions.conf
same => n(from),Set(__SIPFROMUSER=${CALLERID(num)})
same => n,GotoIf($["${GLOBAL(FREENUMDOMAIN)}" = ""]?dial)
; check if we set the FREENUMDOMAIN global variable in [global]
same => n,Set(__SIPFROMDOMAIN=${GLOBAL(FREENUMDOMAIN)})
; if we did set it, then we'll use it for our outbound dialing
domain
It looks like they were added in 1.6.2.X of Asterisk, so if you are
using 1.8.X or above, you should have them.
On your inbound call, you could use the function SIP_HEADER[1] to
gather the domain and store it for later use when you want to set it
on the outbound call. Though I'm not sure how you could tell that the
call was a redial.
[1]: https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Function_SIP_HEADER
I'm assuming when your SIP client redials that it calls through
Asterisk and is not dialing the previously caller directly.
Hope any of that helps. *Goes off to document SIPFROMDOMAIN and
SIPFROMUSER on the wiki*
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
|
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- 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
--
_____________________________________________________________________
-- 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 |
|
|
rnewton at digium.com Guest
|
Posted: Wed Feb 19, 2014 1:25 pm Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
On Wed, Feb 19, 2014 at 12:12 PM, Torbjörn Abrahamsson
<torbjorn.abrahamsson@gmail.com> wrote:
Quote: | Thank you very much. I will try this! It seems to be what I'm looking for.
I'm in most cases working with 1.2 asterisks, so I'm not up to date on newer features. My current project however needed a newer version. I tried some googleing, but I did not find these variables.
|
Glad to help! Wow.. 1.2 ! Most are using 1.8 or 11 these days, so it
is good to be aware of that when seeking help and Googeling. The 1.8
branch is the oldest supported version at the moment.
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- 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 |
|
|
rnewton at digium.com Guest
|
Posted: Thu Feb 20, 2014 2:01 pm Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
On Thu, Feb 20, 2014 at 3:45 AM, Torbjörn Abrahamsson
<torbjorn.abrahamsson@gmail.com> wrote:
Quote: | I tested SIPFROMDOMAIN, and it worked. Important thing to note is that I needed to have at least one underscore at the beginning of the variable, as your example did, it needs to be inherited at least one level. I don't really see way this should be needed, shouldn't Dial be able see it in the channel that executes the application? Maybe this should be noted on the wiki as well, to avoid this kind of confusion?
|
Glad to hear it worked for you!
Information on variable inheritance is already on the wiki.
Here https://wiki.asterisk.org/wiki/display/AST/Variable+Inheritance+Basics
and here https://wiki.asterisk.org/wiki/display/AST/Variable+Inheritance
Those two pages and their sub-pages have some overlap and may need to
be consolidated.
--
Rusty Newton
Digium, Inc. | Community Support Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
direct: +1 256 428 6200
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- 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 |
|
|
torbjorn.abrahamsson a... Guest
|
Posted: Thu Feb 20, 2014 2:34 pm Post subject: [asterisk-users] Dynamically setting from domain when callin |
|
|
Quote: | Quote: | I tested SIPFROMDOMAIN, and it worked. Important thing to note is that I
needed to have at least one underscore at the beginning of the variable, as
your example did, it needs to be inherited at least one level. I don't really see
way this should be needed, shouldn't Dial be able see it in the channel that
executes the application? Maybe this should be noted on the wiki as well, to
avoid this kind of confusion?
|
Glad to hear it worked for you!
Information on variable inheritance is already on the wiki.
Here https://wiki.asterisk.org/wiki/display/AST/Variable+Inheritance+Basics
and here https://wiki.asterisk.org/wiki/display/AST/Variable+Inheritance
Those two pages and their sub-pages have some overlap and may need to
be consolidated.
|
I was not referring to the concept of inheritance, rather than that I found it odd that I would need the inheritance in this specific case. My gut feeling told me that the Dial application should see the SIPFROMDOMAIN variable without having to resort to inheritance. This seems the logical way to me, although I have no trouble grasping that there may be magic under the hood that makes this operation need the inheritance.
My comment about the wiki was about stating on the SIP CHANNEL VARIABLES page that you need to have the inheritance, otherwise it will not work. If I hadn't seen your example in the mail, I would not have thought "Oh, I need to make this variable inheritable...". I would have thought there was some other problem.
Thanks again for your help!
BR,
Torbjörn Abrahamsson
--
_____________________________________________________________________
-- 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
|