Append information to SIP invite

I am writing a voip app with the rtc api and using asterisk as my sip server.

I am trying to include functionality in my app that allows the calling party to indicate to the called party that a call should be auto answered (the client requires it :stuck_out_tongue: )

I have tried two different methods and am having trouble with both:

  1. I tried to add custom information into the SDP info section of the sip invite request (more specifically i added information to the i= section [session description]).
    But, using ethereal, i have found that asterisk does infact receive the SIP invite request with my modded SDP info, but when asterisk forwards it the the called party asterisk rewrites the SDP info section (always to the same thing) and my custom information is lost.
    Is the a sip.conf flag that i can set to retain (at least) the i= section when asterisk forwards the invite and not have it just rewrite the whole sdp info section of the invite.

If the above is not possible i have tried another approach, but am also having trouble with it.
2) i send a sip info message with custom information just after i send the sip invite request.
Asterisk receives and forwards the invite request but when it receives the sip info message it doesnt forward it to the called party but rather gives me a 415 unsupported media type.
Is there a certain mime type i should use for custom information that asterisk will forward? or is there a sip.conf parameter that i must set to allow sip info forwarding.

Any other suggestions to send custom information along with or just after a sip invite request (that is reliable) are more than welcome as well.

Help in this matter will be very much appreciated.

Thank you !

I think you can try use SIPAddHeader dialplan function.


Marco Bruni

Hello Marco

Thank you for the prompt reply. But unfortunately this doesnt solve the problem im having. It seems SIPAddHeader is inserted statically into the dial plan. In my app it is required that at the time of placing the call the calling party must indicate that the called party must auto answer. And also the rtc api doesnt have access to the sip header. So i require that asterisk preserves at least one line of the sdp message when forwarding a request to a called party rather adding a header.

All i need is to know whether asterisk can retain the “i=session description” line in the sdp section of the sip invite message when forwarding an invite and not have it just discard the sdp message it received



Or no way to add sdp info in the dial plan>?