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.

Thanks,
Mathieu

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

  1. Setting “fromdomain=10.0.0.1:5060” 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@10.0.0.1:5060” 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=10.0.0.1:5060” 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 !

Hello, sorry for “bump” this topic.

I have Astereisk 16.2.1 - Is it possible to add a port to the header of the “from” field? I have NAT on.

I tried setting it in the fromdomain parameter in sip.conf (section general) but the system “cuts” the port.

example:
[general]
fromdomain=99.99.99.99:0000

I would like to have
From: “asterisk” sip:asterisk@99.99.99.99:0000;tag=as3b013ec5

Can anyone guide me to any tutorials?

Thanks,
Marcelina