return SWITCH_STATUS_SUCCESS;
}
+#define WARNING_SYNTAX "<uuid> <warning>"
+SWITCH_STANDARD_API(uuid_warning_function)
+{
+ char *mycmd = NULL, *argv[2] = { 0 };
+ int argc = 0;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ if (!zstr(cmd) && (mycmd = strdup(cmd))) {
+ argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ }
+
+ if (zstr(cmd) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) {
+ stream->write_function(stream, "-USAGE: %s\n", WARNING_SYNTAX);
+ } else {
+ switch_core_session_message_t msg = { 0 };
+ switch_core_session_t *lsession = NULL;
+
+ msg.message_id = SWITCH_MESSAGE_INDICATE_WARNING;
+ msg.string_arg = argv[1];
+ msg.from = __FILE__;
+
+ if ((lsession = switch_core_session_locate(argv[0]))) {
+ status = switch_core_session_receive_message(lsession, &msg);
+ switch_core_session_rwunlock(lsession);
+ }
+ }
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "+OK Success\n");
+ } else {
+ stream->write_function(stream, "-ERR Operation Failed\n");
+ }
+
+ switch_safe_free(mycmd);
+ return SWITCH_STATUS_SUCCESS;
+}
+
#define UUID_SYNTAX "<uuid> <other_uuid>"
SWITCH_STANDARD_API(uuid_bridge_function)
{
SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "uuid_warning", "send popup", uuid_warning_function, WARNING_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_media", "media", uuid_media_function, MEDIA_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
switch_console_set_complete("add fsctl hupall");
switch_core_session_receive_message(session, &msg);
}
+SWITCH_STANDARD_APP(warning_function)
+{
+ switch_core_session_message_t msg = { 0 };
+
+ /* Tell the channel to redirect */
+ msg.from = __FILE__;
+ msg.string_arg = data;
+ msg.message_id = SWITCH_MESSAGE_INDICATE_WARNING;
+ switch_core_session_receive_message(session, &msg);
+}
+
SWITCH_STANDARD_APP(respond_function)
{
switch_core_session_message_t msg = { 0 };
SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "send_warning", "Send session a popup", "Send session a popup.", warning_function, "<text>",
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
}
break;
+ case SWITCH_MESSAGE_INDICATE_WARNING:
+ {
+ char *message;
+ if (!zstr(msg->string_arg)) {
+ const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
+
+ if (!sofia_test_flag(tech_pvt, TFLAG_UPDATING_DISPLAY)) {
+
+ if ((ua && (switch_stristr("polycom", ua)))) {
+ message = switch_mprintf("Warning: 300 freeswitch \"%s\"", msg->string_arg);
+ sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
+ nua_update(tech_pvt->nh,
+ TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_END());
+ free(message);
+ }
+
+ }
+ }
+ }
+ break;
case SWITCH_MESSAGE_INDICATE_DISPLAY:
{
const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];