[asterisk-dev] Manager Action sendText

ruben.buron at gmail.com ruben.buron at gmail.com
Tue Sep 22 07:23:13 CDT 2009


Hi, Im reading the code og manager.c searching a way to sendText to a sip  
channel that supported it.
I found a function in manager.c line 2929 in trunk.

static int action_sendtext(struct mansession *s, const struct message *m)
{
struct ast_channel *c = NULL;
const char *name = astman_get_header(m, "Channel");
const char *textmsg = astman_get_header(m, "Message");
int res = 0;

if (ast_strlen_zero(name)) {
astman_send_error(s, m, "No channel specified");
return 0;
}

if (ast_strlen_zero(textmsg)) {
astman_send_error(s, m, "No Message specified");
return 0;
}

if (!(c = ast_channel_get_by_name(name))) {
astman_send_error(s, m, "No such channel");
return 0;
}

ast_channel_lock(c);
res = ast_sendtext(c, textmsg);
ast_channel_unlock(c);
c = ast_channel_unref(c);

if (res > 0) {
astman_send_ack(s, m, "Success");
} else {
astman_send_error(s, m, "Failure");
}

return res;
}

I dont found the register of this action in __init_manager(int reload)  
manager.c 5403 - 5436, here i found the register of the other actions of  
ami,
I want to ask you if the action is stable and ready for use in a stable  
proyect?

I think that I only need ti add manager.c 5437:

+ ast_manager_register_xml("SendText", EVENT_FLAG_CALL, action_sendtext)

It is correct, I need Something more?

Iḿ not a C/C++ pro Developer, I only write some lines and small  
applications, But i found this manager action similar to channel send_text,  
that I think it is posiible to enable action.

Lot of thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20090922/5672468c/attachment-0001.htm 


More information about the asterisk-dev mailing list