Add custom header to all incoming calls

As title says I want whenever I get an incoming call and route it to one of my extension a custom header to be added.

I tried this: exten => 1001,1,SIPAddHeader(X-Asterisk-Testing: Just testing!) but it didn’t worked, i guess this is only for outbound calls.

What i want to achieve is to pass some informations like callid and uniqueid to my webrtc extensions in order to match calls between asterisk db and my crm db.

I hope what i am saying does make sense to you…I am new in asterisk…

It doesn’t make sense to modify headers on incoming calls, as only Asterisk will ever see them, so I assume that you mean calls to local phone devices, which are outgoing calls to them. Asterisk really has no concept of the difference between calls to local phones and to remote central offices, and, although it does have to be aware of local use versus public IP addresses, that doesn’t the set of headers used, only IP addresses used in standard ones.

Which channel driver are you using? There is an alternative way of adding headers for the, currently preferred, chan_pjsip driver, although it was my understanding that the legacy method you are using still works.

Thanks a lot for your immediate answer.

I think that I use legacy sip extensions modified to be webrtc friendly if that make any sense to you.

I use issabel pbx but now, i have to manipulate asterisk conf files by my self in order to achieve my end goal which is to make possible the transfer of some “meta data” about the receiving call to my crm.

Perhaps it will help more if i describe what is my end goal exactly…

I manage my company crm. I have integrate my cloud pbx with the crm and it works very well. I am able to receive calls from my sip trunk provider to my browser…But now i need to find a way to match my crm database call records with asterisk call recordings…

In order to do so i need to pass some indentifinder with the call such us callid or uniqueid.

But i am clueless how i can make it work …

Probably a silly question, but is the the SipAddHeader before the Dial?

It’s not silly at all, as I have mentioned i am very new in asterisk world.

I tried this:
exten => 1001,1,SIPAddHeader(X-Asterisk-Testing: Just testing!)

and this:
exten => 1001,1,SIPAddHeader(X-Asterisk-Testing: Just testing!)
exten => 1001,2,Dial(SIP/1001)

I don’t know which one is correct but i know that second make all calls make from 1001 extension re-routed to itself

Unfortunately, I think you are stabbing in the dark. You need to understand how the dialplan works for simple calls before you start adding headers or using WebRTC.

There is no way that add header will do anything if there is no outgoing call leg. That suggests you don’t understand the basic call processing flow.

If you are trying to customise a GUI based system, you should use the support channels for that GUI.

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