[asterisk-users] Dynamically setting from domain when calling friends

Torbjörn Abrahamsson torbjorn.abrahamsson at gmail.com
Wed Feb 19 12:12:45 CST 2014

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.

Torbjörn Abrahamsson

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at 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:
, but SIPFROMUSER was not. They are now both there! :)

On Wed, Feb 19, 2014 at 9:08 AM, Rusty Newton <rnewton at digium.com> wrote:
> On Tue, Feb 18, 2014 at 3:40 AM, Torbjörn Abrahamsson
> <torbjorn.abrahamsson at gmail.com> wrote:
>> 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:
> 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]
>  ;    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:

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:

More information about the asterisk-users mailing list