Can't set explicit port in FROM field of SIP header

Hi everyone,

I’m running Asterisk 1.4 and I’ve been trying to set the port (sip:user@ip:port) in the SIP header field “from”. I’ve tried setting it in the fromdomain parameter in sip.conf, and in the CALLERID var, but to no avail.

Can anyone guide me to any tutorials? I have the rest of the URI, just not the port, and I can’t get it to show up.


With 5060 being the port of origin and being Asterisk’s IP, I’ve tried the following:

  1. Setting “fromdomain=” on every sip user in sip.conf.
  2. Adding “exten => XXXXX,n,Set(fromdomain=5060)” before the Dial() command
  3. Adding “exten => XXXXX,n,Set(CALLERID(all)=“123” sip:123@” before the Dial() command.

None of these solutions yielded the required results. Is there any way to display the port, other than (and I’m not sure I’d even know where to look) by editing the source code and recompiling?

does it have to be the from field?
Can you use VIA headers?

I started replying yesterday off another computer. How badly do you need it?
I had to customise an install by changing a few things in channels/chan_sip.c to get the stuff we needed in the SIP headers. That’s always an option for you… albeit a PITA option.

Thank you Chris for offering your help :smile:

I’ve worked on it this morning and it finally works, I’ve played around with it and “fromdomain=” in the general context in sip.conf works best, which I override in some cases.

EDIT: Just to specify, it did have to be the FROM field, but thanks for the insight, I might just have to use that next time !