<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">陈帆</b> &lt;<a href="mailto:jeffery9@gmail.com">jeffery9@gmail.com</a>&gt;<br>Date: Apr 30, 2006 10:30 AM<br>Subject: can modify CHAN_SIP.c to generate a new exten=&gt; ext,2,dial(tech/peer) ?
<br>To: Asterisk Users Mailing List - Non-Commercial Discussion &lt;<a href="mailto:asterisk-users@lists.digium.com">asterisk-users@lists.digium.com</a>&gt;<br><br></span>
<div style="DIRECTION: ltr">
<div>Hi, ALL,</div>
<div>&nbsp;</div>
<div>Whether can modify CHAN_SIP.c&nbsp;to add one new&nbsp;<em> <span>int</span> </em><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.diaip.com/api/pbx_8c.html#a175" target="_blank"><em>ast_add_extension
</em></a><em>(<span>const </span><span>char</span> *context, <span>int</span> replace, <span>const</span> <span>char</span> *extension, <span>int</span> priority, <span>const</span> <span>char</span> *label, <span>const</span>
 <span>char</span> *callerid,<span>const</span> <span>char</span> *application, <span>void</span> *data, <span>void</span> (*datad)(<span>void</span> *), <span>const</span> <span>char</span> *registrar)</em>&nbsp; to generate a new exten=&gt; ext,2,dial(tech/peer)
<br><br>&nbsp;</div>
<div>01610 void register_peer_exten&nbsp;&nbsp;(&nbsp;&nbsp;struct sip_peer *&nbsp;&nbsp;&nbsp;&nbsp;peer,&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;onoff&nbsp;&nbsp;)&nbsp;&nbsp;<br><br>01613 {<br>01614&nbsp;&nbsp;&nbsp;&nbsp;char multi[256];<br>01615&nbsp;&nbsp;&nbsp;&nbsp;char *stringp, *ext;<br>01616&nbsp;&nbsp;&nbsp;&nbsp;if (!ast_strlen_zero(regcontext)) {<br>01617&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ast_copy_string(multi, ast_strlen_zero(peer-&gt;regexten) ? peer-&gt;name : peer-&gt;regexten, sizeof(multi)); 
<br>01618&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stringp = multi;<br>01619&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while((ext = strsep(&amp;stringp, &quot;&amp;&quot;))) {<br>01620&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (onoff)ra<br>01621&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ast_add_extension(regcontext, 1, ext, 1, NULL, NULL, &quot;Noop&quot;, strdup(peer-&gt;name), free, channeltype); 
</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ast_add_extension(regcontext, 1, ext, 2, NULL, NULL, &quot;Dial&quot;, strdup(peer-&gt;name), free, channeltype);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*how to set the *data,,oom....&nbsp;add the exten =&gt; ext, 2, dial(channeltype/peername) */ 
<br>&nbsp;</div>
<div>&nbsp;</div>
<div><br>01622&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>01623&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ast_context_remove_extension(regcontext, ext, 1, NULL);<br>01624&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>01625&nbsp;&nbsp;&nbsp;&nbsp;}<br>01626 }<br><br><br><br><br>-- <br>Jeffery<br><br>iaxtel Num: 1-700-576-1311<br>fwdnet Num: 728150 
<br>&nbsp;</div></div><br clear="all"><br>-- <br>Jeffery<br><br>iaxtel Num: 1-700-576-1311<br>fwdnet Num: 728150