[Freeswitch-svn] [commit] r11089 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Wed Jan 7 11:21:35 PST 2009
Author: gmaruzz
Date: Wed Jan 7 13:21:35 2009
New Revision: 11089
Log:
skypiax: skypiax_call now takes the interface name from outbound_profile
Modified:
freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c Wed Jan 7 13:21:35 2009
@@ -520,10 +520,50 @@
skypiax_interface_t *p = NULL;
switch_core_session_add_stream(*new_session, NULL);
+
+
if ((tech_pvt =
(private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
- tech_pvt->p = &globals.SKYPIAX_INTERFACES[19]; //FIXME
- globals.SKYPIAX_INTERFACES[19].tech_pvt = tech_pvt; //FIXME
+ int found=0;
+ char interface_name[256];
+
+
+ if (strlen(outbound_profile->destination_number)) {
+ int i;
+ char *slash;
+
+ strncpy(interface_name, outbound_profile->destination_number, 255);
+ slash=strchr(interface_name, '/');
+ *slash='\0';
+
+
+ for(i=0; i< SKYPIAX_MAX_INTERFACES; i++){
+
+ if( strlen(globals.SKYPIAX_INTERFACES[i].name) && (strncmp(globals.SKYPIAX_INTERFACES[i].name, interface_name, strlen(interface_name)) == 0 )) {
+
+ DEBUGA_SKYPE( "globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
+ tech_pvt->p = &globals.SKYPIAX_INTERFACES[i]; //FIXME
+ globals.SKYPIAX_INTERFACES[i].tech_pvt = tech_pvt; //FIXME
+ found=1;
+ break;
+ }
+
+ }
+
+ } else {
+ ERRORA( "Doh! no destination number?\n", SKYPIAX_P_LOG);
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+ }
+
+ if(!found){
+ ERRORA( "Doh! no matching interface for |||%s|||?\n", SKYPIAX_P_LOG, interface_name);
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+
+ }
+ //tech_pvt->p = &globals.SKYPIAX_INTERFACES[19]; //FIXME
+ //globals.SKYPIAX_INTERFACES[19].tech_pvt = tech_pvt; //FIXME
channel = switch_core_session_get_channel(*new_session);
skypiax_tech_init(tech_pvt, *new_session, NULL);
} else {
@@ -538,6 +578,10 @@
snprintf(name, sizeof(name), "skypiax/%s", outbound_profile->destination_number);
switch_channel_set_name(channel, name);
+ //NOTICA( "outbound_profile->destination_number=|||%s|||\n", SKYPIAX_P_LOG, outbound_profile->destination_number);
+ //NOTICA( "outbound_profile->username=|||%s|||\n", SKYPIAX_P_LOG, outbound_profile->username);
+ //NOTICA( "outbound_profile->caller_id_name=|||%s|||\n", SKYPIAX_P_LOG, outbound_profile->caller_id_name);
+ //NOTICA( "outbound_profile->caller_id_number=|||%s|||\n", SKYPIAX_P_LOG, outbound_profile->caller_id_number);
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
switch_channel_set_caller_profile(channel, caller_profile);
More information about the Freeswitch-svn
mailing list