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.
On Wed, Jul 16, 2008 at 11:49 AM, Cesar Cepeda <[EMAIL PROTECTED]> wrote:
> Would it be posible to add a uuid_send_dtmf API? 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.
>
>
>
> Here's the code:
>
>
>
> #define UUID_SEND_DTMF_SYNTAX "<uuid> <dtmf_data>"
>
> SWITCH_STANDARD_API(uuid_send_dtmf_function)
>
> {
>
> switch_core_session_t *psession = NULL;
>
> char *mycmd = NULL, *argv[2] = { 0 };
>
> char *uuid = NULL, *dtmf_data = NULL;
>
> int argc = 0;
>
>
>
>
>
> if (session) {
>
> return SWITCH_STATUS_FALSE;
>
> }
>
>
>
> if (switch_strlen_zero(cmd)) {
>
> goto usage;
>
> }
>
>
>
> if (!(mycmd = strdup(cmd))) {
>
> goto usage;
>
> }
>
>
>
> if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) /
> sizeof(argv[0])))) < 2) {
>
> goto usage;
>
> }
>
>
>
> uuid = argv[0];
>
> dtmf_data = argv[1];
>
>
>
> if (switch_strlen_zero(uuid) || switch_strlen_zero(dtmf_data)) {
>
> goto usage;
>
> }
>
>
>
>
>
>
>
> if (!(psession = switch_core_session_locate(uuid))) {
>
> stream->write_function(stream, "-ERR Cannot locate session!\n"
> );
>
> return SWITCH_STATUS_SUCCESS;
>
> }
>
>
>
> switch_core_session_send_dtmf_string(psession, (const char *)
> dtmf_data);
>
> goto done;
>
>
>
> usage:
>
> stream->write_function(stream, "-USAGE: %s\n",
> UUID_SEND_DTMF_SYNTAX);
>
> switch_safe_free(mycmd);
>
>
>
> done:
>
> if (psession) {
>
> switch_core_session_rwunlock(psession);
>
> }
>
>
>
> switch_safe_free(mycmd);
>
> return SWITCH_STATUS_SUCCESS;
>
>
>
> }
>
>
>
>
>
> And on SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) I added:
>
>
>
> SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf
> digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
>
>
>
> Thanks.
>
>
>
> Cesar Cepeda.
>
>
>
> _______________________________________________
> Freeswitch-users mailing list
> [email protected]
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
GTALK/JABBER/PAYPAL:[EMAIL PROTECTED]<[EMAIL PROTECTED]>
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
iax:[EMAIL PROTECTED]/888
googletalk:[EMAIL PROTECTED]<[EMAIL PROTECTED]>
pstn:213-799-1400
_______________________________________________
Freeswitch-users mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org