<div dir="ltr">post it as a jira as a patch to mod_commands.c and the AUTHORS file, also put your name in the code at the top under the contributors section.<br><br><br><br><div class="gmail_quote">On Wed, Jul 16, 2008 at 11:49 AM, Cesar Cepeda &lt;<a href="mailto:cesar@auronix.com">cesar@auronix.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">








<div link="blue" vlink="purple" lang="ES-MX">

<div>

<p><span lang="EN-US">Would it be posible to add a uuid_send_dtmf
API?&nbsp; I coded one copying from another API, it works, but I'm not sure if it's
the correct way of doing it (freeing memory, calling functions, etc), anyway I
would like it if uuid_send_dtmf is added to the trunk.</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">Here's the code:</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt; color: blue;" lang="EN-US">#define</span><span style="font-size: 10pt;" lang="EN-US">
UUID_SEND_DTMF_SYNTAX <span style="color: maroon;">&quot;&lt;uuid&gt;
&lt;dtmf_data&gt;&quot;</span></span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">SWITCH_STANDARD_API(uuid_send_dtmf_function)</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">{</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch_core_session_t
*psession = NULL;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">char</span> *mycmd = NULL, *argv[2] = { 0 };</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">char</span> *uuid = NULL, *dtmf_data = NULL;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">int</span> argc = 0;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (session) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">return</span> SWITCH_STATUS_FALSE;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (switch_strlen_zero(cmd)) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">goto</span> usage;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (!(mycmd = strdup(cmd))) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">goto</span> usage;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> ((argc = switch_separate_string(mycmd, <span style="color: maroon;">&#39; &#39;</span>, argv, (<span style="color: blue;">sizeof</span>(argv)
/ <span style="color: blue;">sizeof</span>(argv[0])))) &lt; 2) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">goto</span> usage;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uuid = argv[0];</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dtmf_data = argv[1];</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (switch_strlen_zero(uuid) ||
switch_strlen_zero(dtmf_data)) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">goto</span> usage;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (!(psession = switch_core_session_locate(uuid))) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stream-&gt;write_function(stream,
<span style="color: maroon;">&quot;-ERR Cannot locate session!\n&quot;</span>);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">return</span> SWITCH_STATUS_SUCCESS;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch_core_session_send_dtmf_string(psession,
(<span style="color: blue;">const</span> <span style="color: blue;">char</span> *)
dtmf_data);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">goto</span> done;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">usage:</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stream-&gt;write_function(stream,
<span style="color: maroon;">&quot;-USAGE: %s\n&quot;</span>,
UUID_SEND_DTMF_SYNTAX);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch_safe_free(mycmd);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">done:</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">if</span> (psession) {</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch_core_session_rwunlock(psession);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch_safe_free(mycmd);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue;">return</span> SWITCH_STATUS_SUCCESS;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;">}</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p style=""><span lang="EN-US">And on </span><span style="font-size: 10pt;" lang="EN-US">SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
I added:</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">SWITCH_ADD_API(commands_api_interface,
<span style="color: maroon;">&quot;uuid_send_dtmf&quot;</span>, <span style="color: maroon;">&quot;send dtmf digits&quot;</span>,
uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">Thanks.</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">&nbsp;</span></p>

<p style=""><span style="font-size: 10pt;" lang="EN-US">Cesar Cepeda.</span></p>

<p><span lang="EN-US">&nbsp;</span></p>

</div>

</div>


<br>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400
</div>