@ -13081,6 +13081,8 @@ static void state_notify_build_xml(int state, int full, const char *exten, const
if ( ( state & AST_EXTENSION_RINGING ) & & sip_cfg . notifyringing ) {
if ( ( state & AST_EXTENSION_RINGING ) & & sip_cfg . notifyringing ) {
const char * local_display = exten ;
const char * local_display = exten ;
char * local_target = ast_strdupa ( mto ) ;
char * local_target = ast_strdupa ( mto ) ;
const char * remote_display = exten ;
char * remote_target = ast_strdupa ( mfrom ) ;
/* There are some limitations to how this works. The primary one is that the
/* There are some limitations to how this works. The primary one is that the
callee must be dialing the same extension that is being monitored . Simply dialing
callee must be dialing the same extension that is being monitored . Simply dialing
@ -13090,16 +13092,28 @@ static void state_notify_build_xml(int state, int full, const char *exten, const
if ( ( caller = ast_channel_callback ( find_calling_channel , NULL , p , 0 ) ) ) {
if ( ( caller = ast_channel_callback ( find_calling_channel , NULL , p , 0 ) ) ) {
char * cid_num ;
char * cid_num ;
char * connected_num ;
int need ;
int need ;
ast_channel_lock ( caller ) ;
ast_channel_lock ( caller ) ;
cid_num = S_COR ( ast_channel_caller ( caller ) - > id . number . valid ,
cid_num = S_COR ( ast_channel_caller ( caller ) - > id . number . valid ,
ast_channel_caller ( caller ) - > id . number . str , " " ) ;
ast_channel_caller ( caller ) - > id . number . str , " " ) ;
need = strlen ( cid_num ) + strlen ( p - > fromdomain ) + sizeof ( " sip:@ " ) ;
need = strlen ( cid_num ) + strlen ( p - > fromdomain ) + sizeof ( " sip:@ " ) ;
local_target = alloca ( need ) ;
remote_target = alloca ( need ) ;
snprintf ( local_target , need , " sip:%s@%s " , cid_num , p - > fromdomain ) ;
snprintf ( remote_target , need , " sip:%s@%s " , cid_num , p - > fromdomain ) ;
local_display = ast_strdupa ( S_COR ( ast_channel_caller ( caller ) - > id . name . valid ,
remote_display = ast_strdupa ( S_COR ( ast_channel_caller ( caller ) - > id . name . valid ,
ast_channel_caller ( caller ) - > id . name . str , " " ) ) ;
ast_channel_caller ( caller ) - > id . name . str , " " ) ) ;
connected_num = S_COR ( ast_channel_connected ( caller ) - > id . number . valid ,
ast_channel_connected ( caller ) - > id . number . str , " " ) ;
need = strlen ( connected_num ) + strlen ( p - > fromdomain ) + sizeof ( " sip:@ " ) ;
local_target = alloca ( need ) ;
snprintf ( local_target , need , " sip:%s@%s " , connected_num , p - > fromdomain ) ;
local_display = ast_strdupa ( S_COR ( ast_channel_connected ( caller ) - > id . name . valid ,
ast_channel_connected ( caller ) - > id . name . str , " " ) ) ;
ast_channel_unlock ( caller ) ;
ast_channel_unlock ( caller ) ;
caller = ast_channel_unref ( caller ) ;
caller = ast_channel_unref ( caller ) ;
}
}
@ -13121,10 +13135,10 @@ static void state_notify_build_xml(int state, int full, const char *exten, const
" <target uri= \" %s \" /> \n "
" <target uri= \" %s \" /> \n "
" </remote> \n "
" </remote> \n "
" <local> \n "
" <local> \n "
" <identity >%s</identity>\n "
" <identity display=\" %s \" >%s</identity>\n "
" <target uri= \" %s \" /> \n "
" <target uri= \" %s \" /> \n "
" </local> \n " ,
" </local> \n " ,
local_display, local_target , local_target , mto , mto ) ;
remote_display, remote_target , remote_target , local_display , local_target , local_target ) ;
} else {
} else {
ast_str_append ( tmp , 0 , " <dialog id= \" %s \" direction= \" recipient \" > \n " , exten ) ;
ast_str_append ( tmp , 0 , " <dialog id= \" %s \" direction= \" recipient \" > \n " , exten ) ;
}
}