Asterisk Add Header between calls

Hi! I have a call between two numbers that need to pass through Asterisk to add a header. The problem is, that I have to have the first number register as a peer to can do this, and I want it to all inbound calls. I’m using Asterisk 16 with chan_sip.

I think about using the Originate Function, but the call cant be completed:

Executing [5511565656@b2b:1] AGI(“SIP/”, ““B2B.php””) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/B2B.php
“B2B.php”: – <SIP/> 1 - Caller: 1133330001
“B2B.php”: – <SIP/> 2 - Channel ----> SIP/
“B2B.php”: – <SIP/> 3 - FROM ----> 1133330001 sip:1133330001@;tag=b0a8674
– AGI Script Executing Application: (Originate) Options: (SIP/1133330001/5511565656,app,Dial,SIP/1133330001/5511565656,eKTU)
[2022-07-22 17:36:30] WARNING[5535][C-00000002]: chan_sip.c:6355 create_addr: Purely numeric hostname (1133330001), and not a peer–rejecting!
– AGI Script Executing Application: (Ringing) Options: ()
– <SIP/>AGI Script B2B.php completed, returning 0
– Executing [5511565656@b2b:2] Answer(“SIP/”, “”) in new stack
> 0x7fa7a8005e30 – Strict RTP switching to RTP target address as source
– Auto fallthrough, channel ‘SIP/’ status is ‘UNKNOWN’

If I register as peer, there is no problem:
Executing [5511565656@b2b:1] AGI(“SIP/1133330001-00000000”, ““B2B.php””) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/B2B.php
“B2B.php”: – <SIP/1133330001-00000000> 1 - Caller es: 1133330001
“B2B.php”: – <SIP/1133330001-00000000> 2 - Channel ----> SIP/1133330001-00000000
“B2B.php”: – <SIP/1133330001-00000000> 3 - FROM ----> 1133330001 sip:1133330001@;tag=b41a2ee6
– AGI Script Executing Application: (Originate) Options: (SIP/1133330001/5511565656,app,Dial,SIP/1133330001/5511565656,eKTU)
== Using SIP RTP CoS mark 5
– Called 1133330001/5511565656
– SIP/1133330001-00000001 is ringing
> 0x55f2726e4f00 – Strict RTP learning after remote address set to:
– SIP/1133330001-00000001 answered

As you can see, in the first case I dont have a correct channel

I don’t understand why you need AGI to add a header.

chan_sip is deprecated and will be removed in just over a year.

Peers don’t need to register, but they do need a sip.conf entry.

As the warning message says, 1133330001 is not a valid hostname. If you want to call a random URI, you must provide at least the domain part, so it needs to be user@domain, user@ip-address, phonenumber@domain, phonenumber@ip-address, domain, or ip-address.

Asterisk routes based on the domain or ip-address, and passes any phonenumber or user to the peer, for it to interpret.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.