How to send custom data form asterisk to sipml5

Hi Team,

i am using asterisk 13.19.1 and sipml5.

i am able to send the custom data form my sipml5 client to asterisk, but not able send custom data form asterisk to sipml5.
i tried sipaddheader but it is not working for asterisk to sipml5.

thanks in advance

When are you trying to send it? Adding a header only works on outgoing calls to a device. Otherwise you have to use another mechanism (like SendText) to do so.

hi jcolp,
thanks for the reply
let me explain it

when i perss the call button into my sipml5 app. i send some unique string (random string by db).
and get this string on my asterisk using sip_header().

after that i want to send asterisk unique id form asterisk to my sipml5 client for some db operations.
by doing this i want to shift my db operations from my asterisk side to my client side.

If you want information out of Asterisk you either have to use an interface like AMI or ARI (both raise events you can watch for), or monitor the sip traffic and parse headers in your application. All of these avenues happen though at specific points in execution time, thus to @jcolp’s question:

When are you trying to send it?

For instance, do you want the unique string sent to your application from Asterisk when a channel leaves a bridge, or when an outbound call is dialed, or at some other point, etc.?

yes i want to sent a unique string form my asterisk to my application when an outbound call is dialed.

It seems like you could just add the information you need to a header in the outgoing call then using the [pj]sip header dialplan function. Sounds like you have already tried that though and it didn’t work for you.

Do you know why it didn’t work? For instance, did the headers not show up in the sipml5 client? Did sipml5 strip them out? Were they on the SIP message leaving Asterisk? You can look at a pcap or Asterisk debug sip trace to help narrow it down.

If they are not on the outgoing message then were the headers added to the correct channel? Were there any errors messages, etc…?