Merge pull request #84 in FS/freeswitch from ~MKVONARX/freeswitch-fs-6897:FS-6897 to master

* commit 'eaaf9468df366429c56366618df9e9be8457ea52':
  FS-6897: uuid_send_info enhancement that allows setting the Content-Type of the SIP INFO message
This commit is contained in:
Mike Jerris 2014-10-07 11:49:02 -05:00
commit 9fe0956d99

View File

@ -3786,25 +3786,31 @@ SWITCH_STANDARD_API(uuid_send_message_function)
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
#define INFO_SYNTAX "<uuid>" #define INFO_SYNTAX "<uuid> [<mime_type> <mime_subtype>] <message>"
SWITCH_STANDARD_API(uuid_send_info_function) SWITCH_STANDARD_API(uuid_send_info_function)
{ {
switch_status_t status = SWITCH_STATUS_FALSE; switch_status_t status = SWITCH_STATUS_FALSE;
char *mycmd = NULL, *argv[2] = { 0 }; char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0; int argc = 0;
if (!zstr(cmd) && (mycmd = strdup(cmd))) { if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} }
if (argc < 1) { if (argc < 1 || argc == 3) {
stream->write_function(stream, "-USAGE: %s\n", INFO_SYNTAX); stream->write_function(stream, "-USAGE: %s\n", INFO_SYNTAX);
} else { } else {
switch_core_session_message_t msg = { 0 }; switch_core_session_message_t msg = { 0 };
switch_core_session_t *lsession = NULL; switch_core_session_t *lsession = NULL;
msg.message_id = SWITCH_MESSAGE_INDICATE_INFO; msg.message_id = SWITCH_MESSAGE_INDICATE_INFO;
msg.string_array_arg[2] = argv[1]; if (argc > 3) {
msg.string_array_arg[0] = argv[1];
msg.string_array_arg[1] = argv[2];
msg.string_array_arg[2] = argv[3];
} else {
msg.string_array_arg[2] = argv[1];
}
msg.from = __FILE__; msg.from = __FILE__;
if ((lsession = switch_core_session_locate(argv[0]))) { if ((lsession = switch_core_session_locate(argv[0]))) {