Check out the code in the function sip_set_rtp_peer,  in
chan_sip.c, to see how to trigger a reINVITE. The harder bit is adding
code to trigger from the dialplan. You want to be sure the SIP dialog
is properly established as well. chan_sip is quite fragile, be careful
not to break it. :)<br>
<br><br><div><span class="gmail_quote">On 10/7/05, <b class="gmail_sendername">Daniel Floyd</b> &lt;<a href="mailto:ncsuengr00@gmail.com">ncsuengr00@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all:<br><br>I've spent the last week looking into this trying to see if there is<br>any support for it and I can't find any.&nbsp;&nbsp;There appears to be ways to<br>override/force a codec at dial time, at least for SIP.&nbsp;&nbsp;IAX appears to
<br>have something in CVS HEAD, but I can't find any docs/explanation for<br>it and haven't dug into the code to figure it out yet.&nbsp;&nbsp;But either<br>way, that's not what I'm looking for.<br><br>I want a call (specifically incoming) to start out as ULAW (via
<br>allow/disallow statements in sip.conf and iax.conf) so I can do fax<br>detection on it (although G726 seems to be pretty reliable for fax in<br>my testing as well).&nbsp;&nbsp;If the call is a fax, leave the call unchanged.<br>
If the call isn't a fax, I want to change the codec to GSM.&nbsp;&nbsp;I know<br>both SIP and IAX protocols support this -- SIP via re-INVITE and IAX<br>by sending a new full VOICE packet with the new codec.&nbsp;&nbsp;Although, I'm<br>not clear in IAX if that actually makes the far end change its codec
<br>as well, which would be desired in this situation.<br><br>What would be great is a dialplan app that can be called to do this<br>dirty work.&nbsp;&nbsp;For example:<br><br>In extensions.conf:<br><br>[incoming]<br>exten =&gt; s,1,Answer
<br>exten =&gt; s,2,Ringing<br>exten =&gt; s,3,NVFaxDetect(|td)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;Great App, by the way!<br>exten =&gt; s,4,ChangeCodec(gsm)<br>exten =&gt; s,105,NoOp(Codec changed failed!)&nbsp;&nbsp;;Do something here if<br>codec change fails.
<br>exten =&gt; s,106,Hangup<br>exten =&gt; s,5,Dial(SIP/${OPERATOR})<br><br>exten =&gt; fax,1,Dial(SIP/${FAX})<br><br>I realize this is perhaps a little oversimpliflied since changing<br>codecs is channel specific, so maybe SIPChangeCodec or IAXChangeCodec
<br>would probably be more realistic, but this gives the basic idea.<br><br>Outbound calls are a easier since I know where the call is coming<br>from.&nbsp;&nbsp;But I'm running CVS stable and right now the only way I see to<br>do this with IAX is to define multiple IAX peers for the same host
<br>with the only difference being the allowed codec.&nbsp;&nbsp;Seems a little<br>cluggy.&nbsp;&nbsp;Maybe the new stuff I saw in CVS HEAD gets around this, but<br>like I said, I couldn't find anything about it with Google or on<br><a href="http://voip-info.org">
voip-info.org</a>.<br><br>Any thoughts?<br><br>And I'm not opposed to trying my hand at this myself.&nbsp;&nbsp;I do pose as a<br>software engineer by day.&nbsp;&nbsp;And I could probably even make this into<br>work-related work.&nbsp;&nbsp;But any pointers from anyone familiar with the IAX
<br>and SIP code would be great as far as how simple or complex this might<br>be based on where the code is at right now.&nbsp;&nbsp;If it would require a lot<br>of &quot;pot stirring&quot;, I don't know that I would want to mess with it, at
<br>least right now.&nbsp;&nbsp;And at the very least, I wanted to generate some<br>discussion on the topic since I couldn't seem to find anything else on<br>it.<br><br>Thanks,<br>Daniel<br>_______________________________________________
<br>Asterisk-Dev mailing list<br><a href="mailto:Asterisk-Dev@lists.digium.com">Asterisk-Dev@lists.digium.com</a><br><a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev
</a><br>To UNSUBSCRIBE or update options visit:<br>&nbsp;&nbsp; <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br></blockquote></div><br>