update last commit
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13188 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1fa1e961e4
commit
a821ad30f5
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
require ESL;
|
||||
|
||||
ESL::eslSetLogLevel(7);
|
||||
|
||||
my $con = ESL::ESLconnection->new("localhost", "8021", "ClueCon");
|
||||
my $e = ESL::ESLevent->new("NOTIFY");
|
||||
|
||||
|
||||
$e->addHeader("from-uri", "sip:1000\@dev.bkw.org");
|
||||
$e->addHeader("to-uri", "sip:1000\@dev.bkw.org");
|
||||
$e->addHeader("event-string", "message-summary");
|
||||
$e->addHeader("content-type", "application/simple-message-summary");
|
||||
$e->addHeader("profile", "internal");
|
||||
|
||||
|
||||
my $body ="Messages-Waiting: yes\nMessage-Account: me\@my.com\nVoice-Message: 0/0 (0/0)\n";
|
||||
$e->addBody($body);
|
||||
$con->sendEvent($e);
|
||||
|
|
@ -2807,6 +2807,37 @@ static void general_event_handler(switch_event_t *event)
|
|||
const char *from_uri = switch_event_get_header(event, "from-uri");
|
||||
sofia_profile_t *profile;
|
||||
|
||||
|
||||
if (to_uri || from_uri) {
|
||||
|
||||
if (!to_uri) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To-URI header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!from_uri) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing From-URI header\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!es) {
|
||||
es = "message-summary";
|
||||
}
|
||||
|
||||
if (!ct) {
|
||||
ct = "application/simple-message-summary";
|
||||
}
|
||||
|
||||
if (!profile_name) {
|
||||
profile_name = "default";
|
||||
}
|
||||
|
||||
if (!(profile = sofia_glue_find_profile(profile_name))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (to_uri && from_uri && ct && es && profile_name && (profile = sofia_glue_find_profile(profile_name))) {
|
||||
nua_handle_t *nh = nua_handle(profile->nua,
|
||||
NULL,
|
||||
|
@ -2818,17 +2849,18 @@ static void general_event_handler(switch_event_t *event)
|
|||
|
||||
nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
|
||||
|
||||
nua_info(nh,
|
||||
nua_notify(nh,
|
||||
NUTAG_NEWSUB(1),
|
||||
NUTAG_WITH_THIS(profile->nua),
|
||||
SIPTAG_EVENT_STR(es),
|
||||
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
|
||||
TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
|
||||
TAG_END());
|
||||
|
||||
|
||||
|
||||
sofia_glue_release_profile(profile);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (uuid && ct && es) {
|
||||
|
@ -2944,7 +2976,6 @@ static void general_event_handler(switch_event_t *event)
|
|||
char buf[1024] = "";
|
||||
char *p;
|
||||
|
||||
|
||||
if (!profile_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Profile Name\n");
|
||||
goto done;
|
||||
|
|
Loading…
Reference in New Issue