Freeswitch-branches
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
February 2009
- 5 participants
- 71 discussions
Author: gmaruzz
Date: Thu Feb 12 03:01:03 2009
New Revision: 11916
Log:
skypiax: cleaning...
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 03:01:03 2009
@@ -492,29 +492,15 @@
*slash = '\0';
if (strncmp("ANY", interface_name, strlen(interface_name)) == 0) {
+ /* we've been asked for the "ANY" interface, let's find the first idle interface */
DEBUGA_SKYPE("Finding one available skype interface\n",
SKYPIAX_P_LOG);
- //find an available one, allowing call like originate skypiax/ANY/another_skypename
-
- for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
- if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
- int skype_state = 0;
-
- tech_pvt = &globals.SKYPIAX_INTERFACES[i];
- skype_state = tech_pvt->interface_state;
- DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n",
- SKYPIAX_P_LOG,
- i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
- if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
- found=1;
- break;
- }
- }
- }
+ tech_pvt = find_available_skypiax_interface();
+ if(tech_pvt)
+ found=1;
}
-
-
for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+ /* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
&&
(strncmp
@@ -528,7 +514,7 @@
DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG,
i, globals.SKYPIAX_INTERFACES[i].name);
- tech_pvt = &globals.SKYPIAX_INTERFACES[i]; //FIXME
+ tech_pvt = &globals.SKYPIAX_INTERFACES[i];
found = 1;
break;
}
@@ -895,7 +881,7 @@
DEBUGA_SKYPE
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].context=%s\n",
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
- NOTICA("Trying to START interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+ NOTICA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
switch_threadattr_create(&skypiax_skypeapi_thread_attr, skypiax_module_pool);
switch_threadattr_stacksize_set(skypiax_skypeapi_thread_attr,
@@ -917,7 +903,7 @@
&globals.SKYPIAX_INTERFACES[interface_id],
skypiax_module_pool);
- switch_sleep(1000000);
+ switch_sleep(100000);
skypiax_skypeaudio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
@@ -1080,7 +1066,7 @@
if (channel) {
switch_dtmf_t dtmf =
{ (char) value[0], switch_core_default_dtmf_duration(0) };
- NOTICA("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit,
+ DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit,
switch_channel_get_name(channel));
switch_mutex_lock(tech_pvt->flag_mutex);
//FIXME: why sometimes DTMFs from here do not seems to be get by FS?
@@ -1198,7 +1184,7 @@
tech_pvt = &globals.SKYPIAX_INTERFACES[i];
skype_state = tech_pvt->interface_state;
- NOTICA("skype interface: %d, name: %s, state: %d\n",
+ DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n",
SKYPIAX_P_LOG,
i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Thu Feb 12 03:01:03 2009
@@ -185,7 +185,7 @@
tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
}
if (!strcasecmp(prop, "DTMF")) {
- NOTICA("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
+ DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
dtmf_received(tech_pvt, value);
}
if (!strcasecmp(prop, "FAILUREREASON")) {
@@ -224,7 +224,7 @@
skypiax_sleep(10000);
sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
skypiax_skype_write(tech_pvt, msg_to_skype);
- NOTICA("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
+ DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
id);
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
} else {
@@ -240,16 +240,16 @@
available_skypiax_interface = find_available_skypiax_interface();
if(available_skypiax_interface){
/* there is a skypiax interface idle, let's transfer the call to it */
- NOTICA ("Let's transfer the skype_call %s to %s interface, because we are already in a skypiax call(%s)\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, id);
+ DEBUGA_SKYPE ("Let's transfer the skype_call %s to %s interface, because we are already in a skypiax call(%s)\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, id);
sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypiax_interface->name);
} else{
/* no skypiax interfaces idle, let's refuse the call */
- NOTICA ("Let's refuse the skype_call %s, because we are already in a skypiax call(%s) and no other skypiax interfaces are available\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+ DEBUGA_SKYPE ("Let's refuse the skype_call %s, because we are already in a skypiax call(%s) and no other skypiax interfaces are available\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
}
skypiax_skype_write(tech_pvt, msg_to_skype);
skypiax_sleep(10000);
- NOTICA
+ DEBUGA_SKYPE
("We (%s) have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
}
@@ -271,7 +271,7 @@
} else if (!strcasecmp(value, "FINISHED")) {
DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
if(!strcasecmp(tech_pvt->skype_call_id, id)){
- NOTICA("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id);
+ DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id);
tech_pvt->skype_call_id[0] = '\0';
if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
//tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
@@ -280,7 +280,7 @@
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
}
}else {
- NOTICA("skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, id);
+ DEBUGA_SKYPE("skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, id);
}
} else if (!strcasecmp(value, "CANCELLED")) {
@@ -353,7 +353,7 @@
outbound_channel_answered(tech_pvt);
}
}else {
- NOTICA("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+ DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
}
} else {
WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
@@ -905,7 +905,7 @@
DEBUGA_SKYPE("got CREATE\n", SKYPIAX_P_LOG);
break;
case WM_DESTROY:
- NOTICA("got DESTROY\n", SKYPIAX_P_LOG);
+ DEBUGA_SKYPE("got DESTROY\n", SKYPIAX_P_LOG);
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
PostQuitMessage(0);
break;
@@ -924,7 +924,7 @@
howmany =
skypiax_pipe_write(tech_pvt->SkypiaxHandles.fdesc[1], (short *) msg_from_skype,
howmany);
- //NOTICA("From Skype API: %s\n", SKYPIAX_P_LOG, msg_from_skype);
+ //DEBUGA_SKYPE("From Skype API: %s\n", SKYPIAX_P_LOG, msg_from_skype);
lReturnCode = 1;
}
break;
1
0
11 Feb '09
Author: gmaruzz
Date: Wed Feb 11 14:47:34 2009
New Revision: 11891
Log:
skypiax: corrected type in config file, a tcp port was used twice
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.conf Wed Feb 11 14:47:34 2009
@@ -1,121 +1,207 @@
-;;
-;;
-; Skypiax Asterisk Driver
-;
-; Configuration file
-; lines beginning with semicolon (" are ignored (commented out)
-;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;
-; The first interface (named skypeclient)
-[skypeclient]
-;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; general settings, valid on all platforms
-;
-;
-; Default language
-;
+;;;;;;;;
+;;;;;;;;
+;;;;;;; Skypiax Asterisk Driver
+;;;;;;;
+;;;;;;; Configuration file
+;;;;;;; lines beginning with semicolon (" are ignored (commented out)
+;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;
+;;;;;;; The first interface (named skypeclient)
+;;;;;;[skypeclient]
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;; general settings, valid on all platforms
+;;;;;;;
+;;;;;;;
+;;;;;;; Default language
+;;;;;;;
+;;;;;;language=en
+;;;;;;;
+;;;;;;; Default context (in extensions.conf, can be overridden with @context syntax)
+;;;;;;;
+;;;;;;context=default
+;;;;;;;
+;;;;;;; Default extension (in extensions.conf) where incoming calls land
+;;;;;;;
+;;;;;;extension=s
+;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;; Debugging settings, valid globally for all interfaces on all platforms
+;;;;;;;
+;;;;;;; the debug values are global for all the interfaces.
+;;;;;;;
+;;;;;;; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax
+;;;;;;;
+;;;;;;; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch
+;;;;;;; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages
+;;;;;;;
+;;;;;;; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all
+;;;;;;; debug_all activate all possible debugging info
+;;;;;;;
+;;;;;;;debug_all=yes
+;;;;;;debug_skype=yes
+;;;;;;debug_pbx=yes
+;;;;;;;debug_sound=yes
+;;;;;;;debug_locks=yes
+;;;;;;;debug_monitorlocks=yes
+;;;;;;
+;;;;;;skype=yes ; legacy setting, leave it to yes
+;;;;;;X11_display=:101
+;;;;;;tcp_cli_port=11234
+;;;;;;tcp_srv_port=11235
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels
+;;;;;;; tweak it if you get horrible (or not hearable) sound
+;;;;;;;
+;;;;;;;boost can be positive or negative (-40 to +40) in db
+;;;;;;;experiment to find which values are best for your computer
+;;;;;;playback_boost=0 ;
+;;;;;;capture_boost=0 ;
+;;;;;;
+;;; [skypiax1]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:101
+;;; tcp_cli_port=15576
+;;; tcp_srv_port=15577
+;;; skype_user=skypiax1
+;;;
+;;; [skypiax2]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:102
+;;; tcp_cli_port=15578
+;;; tcp_srv_port=15579
+;;; skype_user=skypiax2
+;;;
+;;; [skypiax3]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:103
+;;; tcp_cli_port=15580
+;;; tcp_srv_port=15581
+;;; skype_user=skypiax3
+;;;
+[skypiax4]
language=en
-;
-; Default context (in extensions.conf, can be overridden with @context syntax)
-;
context=default
-;
-; Default extension (in extensions.conf) where incoming calls land
-;
extension=s
-;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Debugging settings, valid globally for all interfaces on all platforms
-;
-; the debug values are global for all the interfaces.
-;
-; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax
-;
-; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch
-; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages
-;
-; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all
-; debug_all activate all possible debugging info
-;
-;debug_all=yes
debug_skype=yes
debug_pbx=yes
-;debug_sound=yes
-;debug_locks=yes
-;debug_monitorlocks=yes
+skype=yes ; legacy setting, leave it to yes
+playback_boost=0 ;
+capture_boost=0 ;
+X11_display=:104
+tcp_cli_port=15582
+tcp_srv_port=15583
+skype_user=skypiax4
+[skypiax5]
+language=en
+context=default
+extension=s
+debug_skype=yes
+debug_pbx=yes
+skype=yes ; legacy setting, leave it to yes
+playback_boost=0 ;
+capture_boost=0 ;
+X11_display=:105
+tcp_cli_port=15584
+tcp_srv_port=15585
+skype_user=skypiax5
+
+[skypiax6]
+language=en
+context=default
+extension=s
+debug_skype=yes
+debug_pbx=yes
skype=yes ; legacy setting, leave it to yes
-X11_display=:101
-tcp_cli_port=11234
-tcp_srv_port=11235
-skype_user=gmaruzz2
-;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels
-; tweak it if you get horrible (or not hearable) sound
-;
-;boost can be positive or negative (-40 to +40) in db
-;experiment to find which values are best for your computer
playback_boost=0 ;
capture_boost=0 ;
+X11_display=:106
+tcp_cli_port=15586
+tcp_srv_port=16586
+skype_user=skypiax6
-;;;[skypeclient2]
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;; general settings, valid on all platforms
-;;;;
-;;;;
-;;;; Default language
-;;;;
-;;;language=en
-;;;;
-;;;; Default context (in extensions.conf, can be overridden with @context syntax)
-;;;;
-;;;context=default
-;;;;
-;;;; Default extension (in extensions.conf) where incoming calls land
-;;;;
-;;;extension=s
-;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;; Debugging settings, valid globally for all interfaces on all platforms
-;;;;
-;;;; the debug values are global for all the interfaces.
-;;;;
-;;;; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax
-;;;;
-;;;; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch
-;;;; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages
-;;;;
-;;;; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all
-;;;; debug_all activate all possible debugging info
-;;;;
-;;;;debug_all=yes
-;;;debug_skype=yes
-;;;debug_pbx=yes
-;;;;debug_sound=yes
-;;;;debug_locks=yes
-;;;;debug_monitorlocks=yes
-;;;
-;;;skype=yes ; legacy setting, leave it to yes
-;;;X11_display=:102
-;;;tcp_cli_port=11236
-;;;tcp_srv_port=11237
-;;;skype_user=gmaruzz3
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels
-;;;; tweak it if you get horrible (or not hearable) sound
-;;;;
-;;;;boost can be positive or negative (-40 to +40) in db
-;;;;experiment to find which values are best for your computer
-;;;playback_boost=0 ;
-;;;capture_boost=0 ;
-;;;
-;;;
+;;; [skypiax17]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:117
+;;; tcp_cli_port=15587
+;;; tcp_srv_port=15588
+;;; skype_user=skypiax17
+;;;
+;;; [skypiax18]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:118
+;;; tcp_cli_port=15589
+;;; tcp_srv_port=15590
+;;; skype_user=skypiax18
+;;;
+;;; [skypiax19]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:119
+;;; tcp_cli_port=15591
+;;; tcp_srv_port=15592
+;;; skype_user=skypiax19
+;;;
+;;; [skypiax20]
+;;; language=en
+;;; context=default
+;;; extension=s
+;;; debug_skype=yes
+;;; debug_pbx=yes
+;;; skype=yes ; legacy setting, leave it to yes
+;;; playback_boost=0 ;
+;;; capture_boost=0 ;
+;;; X11_display=:120
+;;; tcp_cli_port=15593
+;;; tcp_srv_port=15594
+;;; skype_user=skypiax20
+;;;
+;;;
+;;;
1
0
[commit] r11890 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: gmaruzz
Date: Wed Feb 11 14:24:59 2009
New Revision: 11890
Log:
skypiax: multiple incoming calls to the same skype_name is working on FS, is working but deadlocks on * ;-) (gotta fix it soon)
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Wed Feb 11 14:24:59 2009
@@ -2316,6 +2316,41 @@
return RESULT_SUCCESS;
}
+
+private_t *find_available_skypiax_interface(void) {
+ private_t *p;
+ int found = 0;
+
+ /* lock the interfaces' list */
+ LOKKA(&skypiax_iflock);
+ /* make a pointer to the first interface in the interfaces list */
+ p = skypiax_iflist;
+ /* Search for the requested interface and verify if is unowned */
+ while (p) {
+ if (!p->owner) {
+ DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
+ found = 1;
+ /* we found the requested interface, bail out from the while loop */
+ break;
+ } else {
+ /* interface owned by a channel */
+ DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
+ }
+ /* not yet found, next please */
+ p = p->next;
+ }
+
+ /* lock the interfaces' list */
+ UNLOCKA(&skypiax_iflock);
+
+
+ if(found)
+ return p;
+ else
+ return NULL;
+}
+
+
/************************************************/
#ifdef ASTERISK_VERSION_1_4
#ifndef AST_MODULE
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Wed Feb 11 14:24:59 2009
@@ -415,6 +415,7 @@
int skypiax_pipe_write(int pipe, short *buf, int howmany);
#endif /* WIN32 */
int skypiax_close_socket(unsigned int fd);
+private_t *find_available_skypiax_interface(void);
#define SKYPIAX_STATE_DOWN AST_STATE_DOWN
#define SKYPIAX_STATE_RING AST_STATE_RING
#define SKYPIAX_STATE_DIALING AST_STATE_DIALING
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Wed Feb 11 14:24:59 2009
@@ -1187,6 +1187,32 @@
return 0;
}
+private_t *find_available_skypiax_interface(void) {
+ private_t *tech_pvt;
+ int found = 0;
+ int i;
+
+ for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+ if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+ int skype_state = 0;
+
+ tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+ skype_state = tech_pvt->interface_state;
+ NOTICA("skype interface: %d, name: %s, state: %d\n",
+ SKYPIAX_P_LOG,
+ i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
+ if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
+ found=1;
+ break;
+ }
+ }
+ }
+
+ if(found)
+ return tech_pvt;
+ else
+ return NULL;
+}
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Wed Feb 11 14:24:59 2009
@@ -269,3 +269,4 @@
int skypiax_pipe_write(int pipe, short *buf, int howmany);
#endif /* WIN32 */
int skypiax_close_socket(unsigned int fd);
+private_t *find_available_skypiax_interface(void);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Wed Feb 11 14:24:59 2009
@@ -56,7 +56,7 @@
("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
SKYPIAX_P_LOG);
skypiax_sleep(1000000);
- skypiax_skype_write(tech_pvt, "PROTOCOL 6");
+ skypiax_skype_write(tech_pvt, "PROTOCOL 7");
skypiax_sleep(10000);
return 0;
}
@@ -224,17 +224,34 @@
skypiax_sleep(10000);
sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
skypiax_skype_write(tech_pvt, msg_to_skype);
- DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
+ NOTICA("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
id);
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
} else {
- /* we're owned, we're in a call, let's refuse */
+ /* we're owned, we're in a call, let's try to transfer */
+ /************************** TODO
+ Checking here if it is possible to transfer this call to Test2
+ -> GET CALL 288 CAN_TRANSFER Test2
+ <- CALL 288 CAN_TRANSFER test2 TRUE
+ **********************************/
+
+ private_t *available_skypiax_interface;
+
+ available_skypiax_interface = find_available_skypiax_interface();
+ if(available_skypiax_interface){
+ /* there is a skypiax interface idle, let's transfer the call to it */
+ NOTICA ("Let's transfer the skype_call %s to %s interface, because we are already in a skypiax call(%s)\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, id);
+ sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypiax_interface->name);
+ } else{
+ /* no skypiax interfaces idle, let's refuse the call */
+ NOTICA ("Let's refuse the skype_call %s, because we are already in a skypiax call(%s) and no other skypiax interfaces are available\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
+ }
skypiax_skype_write(tech_pvt, msg_to_skype);
skypiax_sleep(10000);
- DEBUGA_SKYPE
- ("We have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
- SKYPIAX_P_LOG, id);
+ NOTICA
+ ("We (%s) have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
+ SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
}
} else {
/* we are calling out */
@@ -251,16 +268,22 @@
SKYPIAX_P_LOG, id);
} else if (!strcasecmp(value, "MISSED")) {
DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "FINISHED")) {
- DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
- } else if (!strcasecmp(value, "CANCELLED")) {
+ } else if (!strcasecmp(value, "FINISHED")) {
+ DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
+ if(!strcasecmp(tech_pvt->skype_call_id, id)){
+ NOTICA("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ }else {
+ NOTICA("skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, id);
+ }
+
+ } else if (!strcasecmp(value, "CANCELLED")) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
DEBUGA_SKYPE
("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
@@ -306,28 +329,33 @@
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "INPROGRESS")) {
- char msg_to_skype[1024];
- tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_UP;
- DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
- sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
- tech_pvt->tcp_cli_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- start_audio_threads(tech_pvt);
- sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
- tech_pvt->tcp_srv_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
- if (!strlen(tech_pvt->session_uuid_str)) {
- DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
- new_inbound_channel(tech_pvt);
- } else {
- DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
- outbound_channel_answered(tech_pvt);
- }
- } else {
+ } else if (!strcasecmp(value, "INPROGRESS")) {
+ char msg_to_skype[1024];
+
+ if(!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id) || !strcasecmp(tech_pvt->skype_call_id, id)){
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_UP;
+ DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_cli_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ start_audio_threads(tech_pvt);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_srv_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+ if (!strlen(tech_pvt->session_uuid_str)) {
+ DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
+ new_inbound_channel(tech_pvt);
+ } else {
+ DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
+ outbound_channel_answered(tech_pvt);
+ }
+ }else {
+ NOTICA("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+ }
+ } else {
WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
value);
}
@@ -636,7 +664,7 @@
memset(cli_out, 0, sizeof(cli_out));
len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
len = send(fd, (char *) cli_out, sizeof(cli_out)/2, 0);
- DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
+ //DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
}
}
@@ -1286,7 +1314,7 @@
return NULL;
}
- snprintf(buf, 512, "PROTOCOL 6");
+ snprintf(buf, 512, "PROTOCOL 7");
if (!skypiax_skype_send_message(SkypiaxHandles, buf)) {
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
1
0
[commit] r11751 - in freeswitch/branches/gmaruzz/mod_skypiax: . configs
by FreeSWITCH SVN 11 Feb '09
by FreeSWITCH SVN 11 Feb '09
11 Feb '09
Author: gmaruzz
Date: Wed Feb 11 06:32:35 2009
New Revision: 11751
Log:
skypiax: outbound interface automatic selection, Seven Du patch: you can call skypiax/ANY/another_skypename, it will automatically chose first available channel.
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/configs/default.xml Wed Feb 11 06:32:35 2009
@@ -266,14 +266,21 @@
<!-- dial via skypiax -->
<extension name="skypiax">
- <condition field="destination_number" expression="^2908$">
+ <condition field="destination_number" expression="^2909$">
<action application="bridge" data="skypiax/skypiax1/echo123"/>
</condition>
</extension>
- <!-- dial via SKYPE uri -->
+
+ <!-- dial via skypiax ANY interface -->
+ <extension name="skypiax">
+ <condition field="destination_number" expression="^2908$">
+ <action application="bridge" data="skypiax/ANY/echo123"/>
+ </condition>
+ </extension>
+ <!-- dial via SKYPE uri with skypiax ANY interface-->
<extension name="skype_uri">
<condition field="destination_number" expression="^skype/(.*)$">
- <action application="bridge" data="skypiax/skypiax1/$1"/>
+ <action application="bridge" data="skypiax/ANY/$1"/>
</condition>
</extension>
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Wed Feb 11 06:32:35 2009
@@ -491,8 +491,30 @@
slash = strrchr(interface_name, '/');
*slash = '\0';
- for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
+ if (strncmp("ANY", interface_name, strlen(interface_name)) == 0) {
+ DEBUGA_SKYPE("Finding one available skype interface\n",
+ SKYPIAX_P_LOG);
+ //find an available one, allowing call like originate skypiax/ANY/another_skypename
+
+ for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+ if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+ int skype_state = 0;
+
+ tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+ skype_state = tech_pvt->interface_state;
+ DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n",
+ SKYPIAX_P_LOG,
+ i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
+ if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
+ found=1;
+ break;
+ }
+ }
+ }
+ }
+
+ for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
&&
(strncmp
1
0
[commit] r11737 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
by FreeSWITCH SVN 10 Feb '09
by FreeSWITCH SVN 10 Feb '09
10 Feb '09
Author: gmaruzz
Date: Tue Feb 10 17:46:42 2009
New Revision: 11737
Log:
skypiax: * wait for all interfaces to be connected to Skype client AND identified the correct client on cygwin
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Tue Feb 10 17:46:42 2009
@@ -783,6 +783,7 @@
struct ast_config *cfg;
struct skypiax_pvt *tmp;
struct skypiax_pvt *p = NULL;
+ struct skypiax_pvt *p2 = NULL;
#ifdef ASTERISK_VERSION_1_6
struct ast_flags config_flags = { 0 };
#endif /* ASTERISK_VERSION_1_6 */
@@ -857,6 +858,28 @@
ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
return -1;
}
+ /* go through the interfaces list (skypiax_iflist) WITHOUT locking */
+ p = skypiax_iflist;
+ while (p) {
+ int i;
+ /* for each interface in list */
+ p2 = p->next;
+ NOTICA("STARTING interface %s, please be patient\n", SKYPIAX_P_LOG, p->name);
+ i=0;
+ while (p->SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME
+ usleep(1000);
+ i++;
+ }
+ if (p->SkypiaxHandles.api_connected){
+ NOTICA("Interface %s is now STARTED\n", SKYPIAX_P_LOG, p->name);
+ } else {
+ ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
+ running = 0;
+ return -1;
+ }
+ /* next one, please */
+ p = p2;
+ }
return 0;
}
@@ -1832,7 +1855,6 @@
#endif
- NOTICA("Here\n", SKYPIAX_P_LOG);
return 0;
}
int outbound_channel_answered(private_t *p) {
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Tue Feb 10 17:46:42 2009
@@ -82,7 +82,7 @@
WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
}
if (!strcasecmp(message, "ERROR")) {
- WARNINGA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
+ DEBUGA_SKYPE("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
tech_pvt->skype_call_id[0] = '\0';
@@ -1062,7 +1062,7 @@
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0) != 0) {
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle =
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle;
- while (1) {
+ while (running) {
MSG oMessage;
if (!running)
break;
1
0
Author: gmaruzz
Date: Tue Feb 10 15:30:05 2009
New Revision: 11733
Log:
skypiax: better sounding by keeping busy with zeros the skype accepting socket when we would not send packets. No more scratches going from one word to another in IVRs
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Tue Feb 10 15:30:05 2009
@@ -474,7 +474,6 @@
}
} else if (len == 0) {
- DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
skypiax_sleep(1000);
} else {
ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
@@ -507,7 +506,7 @@
break;
}
- DEBUGA_SKYPE("incoming audio server (I am it) GONE\n", SKYPIAX_P_LOG);
+ DEBUGA_SKYPE("incoming audio server (I am it) EXITING\n", SKYPIAX_P_LOG);
skypiax_close_socket(s);
return NULL;
}
@@ -614,8 +613,9 @@
ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
}
- /* send the 16khz frame to the Skype client waiting for incoming audio */
+ /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party*/
len = send(fd, (char *) cli_out, got, 0);
+ skypiax_sleep(5000); //5 msec
if (len == -1) {
break;
@@ -631,11 +631,12 @@
(int)(SAMPLES_PER_FRAME * sizeof(short)));
}
} else {
- //if (rt)
+ if (rt)
ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
memset(cli_out, 0, sizeof(cli_out));
len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
- //skypiax_sleep(10000);
+ len = send(fd, (char *) cli_out, sizeof(cli_out)/2, 0);
+ DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
}
}
@@ -644,7 +645,7 @@
break;
}
- DEBUGA_SKYPE("outbound audio server (I am it) GONE\n", SKYPIAX_P_LOG);
+ DEBUGA_SKYPE("outbound audio server (I am it) EXITING\n", SKYPIAX_P_LOG);
skypiax_close_socket(s);
return NULL;
}
1
0
Author: gmaruzz
Date: Tue Feb 10 10:44:18 2009
New Revision: 11728
Log:
skypiax: better audio quality by keeping skype socket busy on *nix and cygwin
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Tue Feb 10 10:44:18 2009
@@ -565,16 +565,25 @@
if (!running)
break;
- fdselect = fd;
FD_ZERO(&fs);
- FD_SET(fdselect, &fs);
- to.tv_usec = 2000000; //2000 msec
+ to.tv_usec = 60000; //60msec
to.tv_sec = 0;
+#if defined(WIN32) && !defined(__CYGWIN__)
+/* on win32 we cannot select from the apr "pipe", so we select on socket writability */
+ fdselect = fd;
+ FD_SET(fdselect, &fs);
rt = select(fdselect + 1, NULL, &fs, NULL, &to);
+#else
+/* on *unix and cygwin we select from the real pipe */
+ fdselect = tech_pvt->audioskypepipe[0];
+ FD_SET(fdselect, &fs);
- if (rt > 0) {
+ rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+#endif
+
+ if (rt > 0) {
/* read from the pipe the audio frame we are supposed to send out */
got =
skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
@@ -622,9 +631,11 @@
(int)(SAMPLES_PER_FRAME * sizeof(short)));
}
} else {
- if (rt)
+ //if (rt)
ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
- skypiax_sleep(10000);
+ memset(cli_out, 0, sizeof(cli_out));
+ len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
+ //skypiax_sleep(10000);
}
}
1
0
Author: gmaruzz
Date: Tue Feb 10 03:19:09 2009
New Revision: 11727
Log:
skypiax: shut up the compiler on ubuntu 8.04 64 bit
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Tue Feb 10 03:19:09 2009
@@ -467,7 +467,7 @@
SAMPLES_PER_FRAME * sizeof(short));
if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany,
- SAMPLES_PER_FRAME * sizeof(short));
+ (int)(SAMPLES_PER_FRAME * sizeof(short)));
}
/* done with the stored half frame */
tech_pvt->audiobuf_is_loaded = 0;
@@ -581,7 +581,7 @@
SAMPLES_PER_FRAME * sizeof(short));
if (got != SAMPLES_PER_FRAME * sizeof(short)) {
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- SAMPLES_PER_FRAME * sizeof(short));
+ (int)(SAMPLES_PER_FRAME * sizeof(short)));
}
if (got == SAMPLES_PER_FRAME * sizeof(short)) {
@@ -619,7 +619,7 @@
} else {
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- SAMPLES_PER_FRAME * sizeof(short));
+ (int)(SAMPLES_PER_FRAME * sizeof(short)));
}
} else {
if (rt)
@@ -649,7 +649,7 @@
if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
if (samples)
WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples,
- SAMPLES_PER_FRAME * sizeof(short));
+ (int)(SAMPLES_PER_FRAME * sizeof(short)));
return 0;
} else {
/* A real frame */
1
0
Author: gmaruzz
Date: Mon Feb 9 13:25:18 2009
New Revision: 11719
Log:
skypiax: cleaning skypiax_protocol.c
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Mon Feb 9 13:25:18 2009
@@ -1058,13 +1058,16 @@
if (channel) {
switch_dtmf_t dtmf =
{ (char) value[0], switch_core_default_dtmf_duration(0) };
- DEBUGA_SKYPE("%c DTMF %s\n", SKYPIAX_P_LOG, dtmf.digit,
+ NOTICA("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit,
switch_channel_get_name(channel));
switch_mutex_lock(tech_pvt->flag_mutex);
+ //FIXME: why sometimes DTMFs from here do not seems to be get by FS?
switch_channel_queue_dtmf(channel, &dtmf);
switch_set_flag(tech_pvt, TFLAG_DTMF);
switch_mutex_unlock(tech_pvt->flag_mutex);
- }
+ } else {
+ WARNINGA("received %c DTMF, but no channel?\n", SKYPIAX_P_LOG, value[0]);
+ }
switch_core_session_rwunlock(session);
return 0;
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Mon Feb 9 13:25:18 2009
@@ -23,309 +23,8 @@
#endif /* WIN32 */
/*************************************/
-void *skypiax_do_tcp_srv_thread_func(void *obj)
-{
- private_t *tech_pvt = obj;
- int s;
- unsigned int len;
- unsigned int i;
- unsigned int a;
-#if defined(WIN32) && !defined(__CYGWIN__)
- int sin_size;
-#else /* WIN32 */
- unsigned int sin_size;
-#endif /* WIN32 */
- unsigned int fd;
- short srv_in[SAMPLES_PER_FRAME];
- short srv_out[SAMPLES_PER_FRAME / 2];
- struct sockaddr_in my_addr;
- struct sockaddr_in remote_addr;
- int exit = 0;
- unsigned int kill_cli_size;
- short kill_cli_buff[SAMPLES_PER_FRAME];
- short totalbuf[SAMPLES_PER_FRAME];
-
- memset(&my_addr, 0, sizeof(my_addr));
- my_addr.sin_family = AF_INET;
- my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */
- my_addr.sin_port = htons(tech_pvt->tcp_srv_port);
-
- if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- ERRORA("socket Error\n", SKYPIAX_P_LOG);
- return NULL;
- }
-
- if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
- ERRORA("bind Error\n", SKYPIAX_P_LOG);
- return NULL;
- }
- DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
-
- listen(s, 6);
-
- sin_size = sizeof(remote_addr);
- while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
- DEBUGA_SKYPE("ACCEPTED\n", SKYPIAX_P_LOG);
- if (!running)
- break;
- while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
- && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
- || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
-
- unsigned int fdselect;
- int rt;
- fd_set fs;
- struct timeval to;
-
- if (!running)
- break;
- exit = 1;
-
- fdselect = fd;
- FD_ZERO(&fs);
- FD_SET(fdselect, &fs);
- to.tv_usec = 2000000; //2000 msec
- to.tv_sec = 0;
-
- rt = select(fdselect + 1, &fs, NULL, NULL, &to);
- if (rt > 0) {
-
- len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time
-
- if (len == 320) {
- unsigned int howmany;
-
- if (SAMPLERATE_SKYPIAX == 8000) {
- /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */
- a = 0;
- for (i = 0; i < len / sizeof(short); i++) {
- srv_out[a] = srv_in[i];
- i++;
- a++;
- }
- } else if (SAMPLERATE_SKYPIAX == 16000) {
- /* we're NOT downsampling, srv_out will contain ALL samples from srv_in */
- for (i = 0; i < len / sizeof(short); i++) {
- srv_out[i] = srv_in[i];
- }
- } else {
- ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
- }
- /* if not yet done, let's store the half incoming frame */
- if (!tech_pvt->audiobuf_is_loaded) {
- for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
- tech_pvt->audiobuf[i] = srv_out[i];
- }
- tech_pvt->audiobuf_is_loaded = 1;
- } else {
- /* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */
- for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
- totalbuf[i] = tech_pvt->audiobuf[i];
- }
- for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) {
- totalbuf[i] = srv_out[a];
- i++;
- }
- /* send the complete frame through the pipe to our code waiting for incoming audio */
- howmany =
- skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf,
- SAMPLES_PER_FRAME * sizeof(short));
- if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
- ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany,
- SAMPLES_PER_FRAME * sizeof(short));
- }
- /* done with the stored half frame */
- tech_pvt->audiobuf_is_loaded = 0;
- }
-
- } else if (len == 0) {
- DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
- skypiax_sleep(1000);
- } else {
- ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
- exit = 1;
- break;
- }
-
- } else {
- if (rt)
- ERRORA("SRV rt=%d\n", SKYPIAX_P_LOG, rt);
- skypiax_sleep(10000);
- }
-
- }
-
- /* let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die */
- kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
- len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
- kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
- len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
- len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
- kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
- len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
-
- DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
- skypiax_close_socket(fd);
- if (exit)
- break;
- }
-
- DEBUGA_SKYPE("incoming audio server (I am it) GONE\n", SKYPIAX_P_LOG);
- skypiax_close_socket(s);
- return NULL;
-}
-
-void *skypiax_do_tcp_cli_thread_func(void *obj)
-{
- private_t *tech_pvt = obj;
- int s;
- struct sockaddr_in my_addr;
- struct sockaddr_in remote_addr;
- unsigned int got;
- unsigned int len;
- unsigned int i;
- unsigned int a;
- unsigned int fd;
- short cli_out[SAMPLES_PER_FRAME * 2];
- short cli_in[SAMPLES_PER_FRAME];
-#ifdef WIN32
- int sin_size;
-#else
- unsigned int sin_size;
-#endif /* WIN32 */
-
- memset(&my_addr, 0, sizeof(my_addr));
- my_addr.sin_family = AF_INET;
- my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */
- my_addr.sin_port = htons(tech_pvt->tcp_cli_port);
-
- if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- ERRORA("socket Error\n", SKYPIAX_P_LOG);
- return NULL;
- }
-
- if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
- ERRORA("bind Error\n", SKYPIAX_P_LOG);
- skypiax_close_socket(s);
- return NULL;
- }
- DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-
- listen(s, 6);
-
- sin_size = sizeof(remote_addr);
- while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
- DEBUGA_SKYPE("ACCEPTED\n", SKYPIAX_P_LOG);
- if (!running)
- break;
- while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
- && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
- || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
- unsigned int fdselect;
- int rt;
- fd_set fs;
- struct timeval to;
-
- if (!running)
- break;
- fdselect = fd;
- FD_ZERO(&fs);
- FD_SET(fdselect, &fs);
- to.tv_usec = 2000000; //2000 msec
- to.tv_sec = 0;
-
- rt = select(fdselect + 1, NULL, &fs, NULL, &to);
-
- if (rt > 0) {
-
- /* read from the pipe the audio frame we are supposed to send out */
- got =
- skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
- SAMPLES_PER_FRAME * sizeof(short));
- if (got != SAMPLES_PER_FRAME * sizeof(short)) {
- WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- SAMPLES_PER_FRAME * sizeof(short));
- }
-
- if (got == SAMPLES_PER_FRAME * sizeof(short)) {
- if (SAMPLERATE_SKYPIAX == 8000) {
-
- /* we're upsampling from 8khz to 16khz, cli_out will contain two times each sample from cli_in */
- a = 0;
- for (i = 0; i < got / sizeof(short); i++) {
- cli_out[a] = cli_in[i];
- a++;
- cli_out[a] = cli_in[i];
- a++;
- }
- got = got * 2;
- } else if (SAMPLERATE_SKYPIAX == 16000) {
- /* we're NOT upsampling, cli_out will contain just ALL samples from cli_in */
- for (i = 0; i < got / sizeof(short); i++) {
- cli_out[i] = cli_in[i];
- }
- } else {
- ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
- }
-
- /* send the 16khz frame to the Skype client waiting for incoming audio */
- len = send(fd, (char *) cli_out, got, 0);
-
- if (len == -1) {
- break;
- } else if (len != got) {
- ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
- skypiax_sleep(1000);
- break;
- }
-
- } else {
-
- WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- SAMPLES_PER_FRAME * sizeof(short));
- }
- } else {
- if (rt)
- ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
- skypiax_sleep(10000);
- }
-
- }
- DEBUGA_SKYPE("Skype outbound audio GONE\n", SKYPIAX_P_LOG);
- skypiax_close_socket(fd);
- break;
- }
-
- DEBUGA_SKYPE("outbound audio server (I am it) GONE\n", SKYPIAX_P_LOG);
- skypiax_close_socket(s);
- return NULL;
-}
-
-int skypiax_skypeaudio_read(private_t * tech_pvt)
-{
- unsigned int samples;
-
- samples =
- skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data,
- SAMPLES_PER_FRAME * sizeof(short));
-
- if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
- if (samples)
- WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples,
- SAMPLES_PER_FRAME * sizeof(short));
- return 0;
- } else {
- /* A real frame */
- tech_pvt->read_frame.datalen = samples;
- }
- return 1;
-}
-
int skypiax_skype_read(private_t * tech_pvt)
{
-
char read_from_pipe[4096];
char message[4096];
char message_2[4096];
@@ -361,9 +60,8 @@
skypiax_sleep(10000);
return 0;
}
-
if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
- ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
+ ERRORA("Skype got ERROR: |||%s|||, the (skypeout) number we called was not recognized as valid\n",
SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
@@ -376,9 +74,7 @@
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
}
}
-
strncpy(message_2, message, sizeof(message) - 1);
-
buf = message;
stringp = &buf;
where = strsep(stringp, " ");
@@ -386,7 +82,7 @@
WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
}
if (!strcasecmp(message, "ERROR")) {
- ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
+ WARNINGA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
tech_pvt->skype_call_id[0] = '\0';
@@ -400,11 +96,8 @@
}
if (!strcasecmp(message, "CURRENTUSERHANDLE")) {
strncpy(obj, where, sizeof(obj) - 1);
-
where = strsep(stringp, " ");
-
strncpy(id, where, sizeof(id) - 1);
-
if (!strcasecmp(id, tech_pvt->skype_user)) {
tech_pvt->SkypiaxHandles.api_connected = 1;
DEBUGA_SKYPE
@@ -412,309 +105,557 @@
SKYPIAX_P_LOG, message, obj, id, tech_pvt->skype_user);
}
}
-
if (!strcasecmp(message, "USER")) {
strncpy(obj, where, sizeof(obj) - 1);
-
where = strsep(stringp, " ");
-
strncpy(id, where, sizeof(id) - 1);
-
where = strsep(stringp, " ");
+ strncpy(prop, where, sizeof(prop) - 1);
+ if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
+ char msg_to_skype[256];
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
+ //TODO: allow authorization based on config param
+ sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ }
+ }
+ if (!strcasecmp(message, "MESSAGE")) {
+ strncpy(obj, where, sizeof(obj) - 1);
+ where = strsep(stringp, " ");
+ strncpy(id, where, sizeof(id) - 1);
+ where = strsep(stringp, " ");
+ strncpy(prop, where, sizeof(prop) - 1);
+ if (!strcasecmp(prop, "STATUS")) {
+ where = strsep(stringp, " ");
+ strncpy(value, where, sizeof(value) - 1);
+ if (!strcasecmp(value, "RECEIVED")) {
+ char msg_to_skype[256];
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop, value);
+ //TODO: authomatically flag messages as read based on config param
+ sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ }
+ } else if (!strcasecmp(prop, "BODY")) {
+ char msg_to_skype[256];
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
+ //TODO: authomatically flag messages as read based on config param
+ sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ }
+ }
+ if (!strcasecmp(message, "CALL")) {
+ strncpy(obj, where, sizeof(obj) - 1);
+ where = strsep(stringp, " ");
+ strncpy(id, where, sizeof(id) - 1);
+ where = strsep(stringp, " ");
+ strncpy(prop, where, sizeof(prop) - 1);
+ where = strsep(stringp, " ");
+ strncpy(value, where, sizeof(value) - 1);
+ where = strsep(stringp, " ");
+
+ DEBUGA_SKYPE
+ ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
+
+ if (!strcasecmp(prop, "PARTNER_HANDLE")) {
+ strncpy(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1);
+ DEBUGA_SKYPE
+ ("the skype_call %s caller PARTNER_HANDLE (tech_pvt->callid_number) is: %s\n",
+ SKYPIAX_P_LOG, id, tech_pvt->callid_number);
+ return CALLFLOW_INCOMING_RING;
+ }
+ if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
+ snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s",
+ value, where ? " " : "", where ? where : "");
+ DEBUGA_SKYPE
+ ("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
+ SKYPIAX_P_LOG, id, tech_pvt->callid_name);
+ }
+ if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) {
+ DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG, id);
+ if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
+ tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
+ }
+ if (!strcasecmp(prop, "CONF_ID") && strcasecmp(value, "0")) {
+ DEBUGA_SKYPE("the skype_call %s is a conference call\n", SKYPIAX_P_LOG, id);
+ if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
+ tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
+ }
+ if (!strcasecmp(prop, "DTMF")) {
+ NOTICA("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
+ dtmf_received(tech_pvt, value);
+ }
+ if (!strcasecmp(prop, "FAILUREREASON")) {
+ DEBUGA_SKYPE
+ ("Skype FAILED on skype_call %s. Let's wait for the FAILED message.\n",
+ SKYPIAX_P_LOG, id);
+ }
+ if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
+ if (strcasecmp(id, tech_pvt->skype_call_id)) {
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE
+ ("We called a Skype contact and he answered us on skype_call: %s.\n",
+ SKYPIAX_P_LOG, id);
+ }
+ }
+ if (!strcasecmp(prop, "STATUS")) {
+
+ if (!strcasecmp(value, "RINGING")) {
+ char msg_to_skype[1024];
+ if (tech_pvt->interface_state != SKYPIAX_STATE_DIALING) {
+ /* we are not calling out */
+ if (!strlen(tech_pvt->skype_call_id)) {
+ /* we are not inside an active call */
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
+ tech_pvt->interface_state = SKYPIAX_STATE_RING;
+ /* no owner, no active call, let's answer */
+ skypiax_skype_write(tech_pvt, "SET AGC OFF");
+ skypiax_sleep(10000);
+ skypiax_skype_write(tech_pvt, "SET AEC OFF");
+ skypiax_sleep(10000);
+ sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_sleep(10000);
+ sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_sleep(10000);
+ sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
+ id);
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ } else {
+ /* we're owned, we're in a call, let's refuse */
+ sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_sleep(10000);
+ DEBUGA_SKYPE
+ ("We have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
+ SKYPIAX_P_LOG, id);
+ }
+ } else {
+ /* we are calling out */
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
+ tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n",
+ SKYPIAX_P_LOG, id);
+ }
+ } else if (!strcasecmp(value, "EARLYMEDIA")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
+ tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+ DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n",
+ SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "MISSED")) {
+ DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "FINISHED")) {
+ DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ } else if (!strcasecmp(value, "CANCELLED")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
+ DEBUGA_SKYPE
+ ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
+ SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ } else if (!strcasecmp(value, "FAILED")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
+ DEBUGA_SKYPE
+ ("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
+ SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else if (!strcasecmp(value, "REFUSED")) {
+ if (!strcasecmp(id, tech_pvt->skype_call_id)) {
+ /* this is the id of the call we are in, probably we generated it */
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
+ DEBUGA_SKYPE
+ ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
+ SKYPIAX_P_LOG, id);
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ tech_pvt->skype_call_id[0] = '\0';
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ /* we're here because were us that refused an incoming call */
+ DEBUGA_SKYPE("we REFUSED skype_call %s\n", SKYPIAX_P_LOG, id);
+ }
+ } else if (!strcasecmp(value, "ROUTING")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
+ tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "UNPLACED")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
+ tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "INPROGRESS")) {
+ char msg_to_skype[1024];
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_UP;
+ DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_cli_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ start_audio_threads(tech_pvt);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_srv_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+ if (!strlen(tech_pvt->session_uuid_str)) {
+ DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
+ new_inbound_channel(tech_pvt);
+ } else {
+ DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
+ outbound_channel_answered(tech_pvt);
+ }
+ } else {
+ WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
+ value);
+ }
+ } //STATUS
+ } //CALL
+ /* the "numbered" messages that follows are used by the directory application, not yet ported */
+ if (!strcasecmp(message, "#333")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[11]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[11]); */
+ memset(tech_pvt->skype_friends, 0, 4096);
+ strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
+ }
+ if (!strcasecmp(message, "#222")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[10]); */
+ memset(tech_pvt->skype_fullname, 0, 512);
+ strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
+ }
+ if (!strcasecmp(message, "#765")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[10]); */
+ memset(tech_pvt->skype_displayname, 0, 512);
+ strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
+ }
+ a = 0;
+ } //message end
+ } //read_from_pipe
+ return 0;
+}
- strncpy(prop, where, sizeof(prop) - 1);
+void *skypiax_do_tcp_srv_thread_func(void *obj)
+{
+ private_t *tech_pvt = obj;
+ int s;
+ unsigned int len;
+ unsigned int i;
+ unsigned int a;
+#if defined(WIN32) && !defined(__CYGWIN__)
+ int sin_size;
+#else /* WIN32 */
+ unsigned int sin_size;
+#endif /* WIN32 */
+ unsigned int fd;
+ short srv_in[SAMPLES_PER_FRAME];
+ short srv_out[SAMPLES_PER_FRAME / 2];
+ struct sockaddr_in my_addr;
+ struct sockaddr_in remote_addr;
+ int exit = 0;
+ unsigned int kill_cli_size;
+ short kill_cli_buff[SAMPLES_PER_FRAME];
+ short totalbuf[SAMPLES_PER_FRAME];
- if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
- char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop);
+ memset(&my_addr, 0, sizeof(my_addr));
+ my_addr.sin_family = AF_INET;
+ my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */
+ my_addr.sin_port = htons(tech_pvt->tcp_srv_port);
- //FIXME: TODO: allow authorization based on config param
- sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- }
- }
+ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ ERRORA("socket Error\n", SKYPIAX_P_LOG);
+ return NULL;
+ }
- if (!strcasecmp(message, "MESSAGE")) {
- strncpy(obj, where, sizeof(obj) - 1);
+ if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
+ ERRORA("bind Error\n", SKYPIAX_P_LOG);
+ return NULL;
+ }
+ DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
- where = strsep(stringp, " ");
+ listen(s, 6);
- strncpy(id, where, sizeof(id) - 1);
+ sin_size = sizeof(remote_addr);
+ while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
+ DEBUGA_SKYPE("ACCEPTED\n", SKYPIAX_P_LOG);
+ if (!running)
+ break;
+ while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
+ && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
+ || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
- where = strsep(stringp, " ");
+ unsigned int fdselect;
+ int rt;
+ fd_set fs;
+ struct timeval to;
- strncpy(prop, where, sizeof(prop) - 1);
+ if (!running)
+ break;
+ exit = 1;
- if (!strcasecmp(prop, "STATUS")) {
+ fdselect = fd;
+ FD_ZERO(&fs);
+ FD_SET(fdselect, &fs);
+ to.tv_usec = 2000000; //2000 msec
+ to.tv_sec = 0;
- where = strsep(stringp, " ");
+ rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+ if (rt > 0) {
- strncpy(value, where, sizeof(value) - 1);
+ len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time
- if (!strcasecmp(value, "RECEIVED")) {
- char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop, value);
+ if (len == 320) {
+ unsigned int howmany;
- //FIXME: TODO: allow authorization based on config param
- sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ if (SAMPLERATE_SKYPIAX == 8000) {
+ /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */
+ a = 0;
+ for (i = 0; i < len / sizeof(short); i++) {
+ srv_out[a] = srv_in[i];
+ i++;
+ a++;
+ }
+ } else if (SAMPLERATE_SKYPIAX == 16000) {
+ /* we're NOT downsampling, srv_out will contain ALL samples from srv_in */
+ for (i = 0; i < len / sizeof(short); i++) {
+ srv_out[i] = srv_in[i];
+ }
+ } else {
+ ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
+ }
+ /* if not yet done, let's store the half incoming frame */
+ if (!tech_pvt->audiobuf_is_loaded) {
+ for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
+ tech_pvt->audiobuf[i] = srv_out[i];
+ }
+ tech_pvt->audiobuf_is_loaded = 1;
+ } else {
+ /* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */
+ for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
+ totalbuf[i] = tech_pvt->audiobuf[i];
+ }
+ for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) {
+ totalbuf[i] = srv_out[a];
+ i++;
+ }
+ /* send the complete frame through the pipe to our code waiting for incoming audio */
+ howmany =
+ skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf,
+ SAMPLES_PER_FRAME * sizeof(short));
+ if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
+ ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany,
+ SAMPLES_PER_FRAME * sizeof(short));
+ }
+ /* done with the stored half frame */
+ tech_pvt->audiobuf_is_loaded = 0;
}
- } else if (!strcasecmp(prop, "BODY")) {
- char msg_to_skype[256];
-
- DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop);
- //FIXME: TODO: on config param ???
- sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ } else if (len == 0) {
+ DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
+ skypiax_sleep(1000);
+ } else {
+ ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
+ exit = 1;
+ break;
}
+ } else {
+ if (rt)
+ ERRORA("SRV rt=%d\n", SKYPIAX_P_LOG, rt);
+ skypiax_sleep(10000);
}
- if (!strcasecmp(message, "CALL")) {
-
- strncpy(obj, where, sizeof(obj) - 1);
-
- where = strsep(stringp, " ");
-
- strncpy(id, where, sizeof(id) - 1);
-
- where = strsep(stringp, " ");
-
- strncpy(prop, where, sizeof(prop) - 1);
-
- where = strsep(stringp, " ");
-
- strncpy(value, where, sizeof(value) - 1);
-
- where = strsep(stringp, " ");
-
- DEBUGA_SKYPE
- ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
-
- if (!strcasecmp(prop, "PARTNER_HANDLE")) {
- strncpy(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1);
- DEBUGA_SKYPE
- ("the skype_call %s caller PARTNER_HANDLE (tech_pvt->callid_number) is: %s\n",
- SKYPIAX_P_LOG, id, tech_pvt->callid_number);
- return CALLFLOW_INCOMING_RING;
- }
- if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
- snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s",
- value, where ? " " : "", where ? where : "");
- DEBUGA_SKYPE
- ("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
- SKYPIAX_P_LOG, id, tech_pvt->callid_name);
- }
- if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) {
- DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG, id);
- if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
- tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
- }
- if (!strcasecmp(prop, "CONF_ID") && strcasecmp(value, "0")) {
- DEBUGA_SKYPE("the skype_call %s is a conference call\n", SKYPIAX_P_LOG, id);
- if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
- tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
- }
+ }
- if (!strcasecmp(prop, "DTMF")) {
+ /* let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die */
+ kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+ len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
+ kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+ len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+ len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
+ kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
+ len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
- DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
+ DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
+ skypiax_close_socket(fd);
+ if (exit)
+ break;
+ }
- dtmf_received(tech_pvt, value);
- }
+ DEBUGA_SKYPE("incoming audio server (I am it) GONE\n", SKYPIAX_P_LOG);
+ skypiax_close_socket(s);
+ return NULL;
+}
- if (!strcasecmp(prop, "FAILUREREASON")) {
- DEBUGA_SKYPE
- ("Skype has FAILED on skype_call %s. Let's wait for the FAILED message.\n",
- SKYPIAX_P_LOG, id);
- }
- if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
- if (strcasecmp(id, tech_pvt->skype_call_id)) {
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE
- ("We called a Skype contact and he answered us on skype_call: %s.\n",
- SKYPIAX_P_LOG, id);
- }
- }
+void *skypiax_do_tcp_cli_thread_func(void *obj)
+{
+ private_t *tech_pvt = obj;
+ int s;
+ struct sockaddr_in my_addr;
+ struct sockaddr_in remote_addr;
+ unsigned int got;
+ unsigned int len;
+ unsigned int i;
+ unsigned int a;
+ unsigned int fd;
+ short cli_out[SAMPLES_PER_FRAME * 2];
+ short cli_in[SAMPLES_PER_FRAME];
+#ifdef WIN32
+ int sin_size;
+#else
+ unsigned int sin_size;
+#endif /* WIN32 */
- if (!strcasecmp(prop, "STATUS")) {
+ memset(&my_addr, 0, sizeof(my_addr));
+ my_addr.sin_family = AF_INET;
+ my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */
+ my_addr.sin_port = htons(tech_pvt->tcp_cli_port);
- if (!strcasecmp(value, "RINGING")) {
- char msg_to_skype[1024];
- if (tech_pvt->interface_state != SKYPIAX_STATE_DIALING) {
- /* we are not calling out */
+ if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ ERRORA("socket Error\n", SKYPIAX_P_LOG);
+ return NULL;
+ }
- if (!strlen(tech_pvt->skype_call_id)) { //FIXME
- /* we are not inside an active call */
- tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
- tech_pvt->interface_state = SKYPIAX_STATE_RING;
- /* no owner, no active call, let's answer */
- skypiax_skype_write(tech_pvt, "SET AGC OFF");
- skypiax_sleep(10000);
- skypiax_skype_write(tech_pvt, "SET AEC OFF");
- skypiax_sleep(10000);
- sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- skypiax_sleep(10000);
- sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- skypiax_sleep(10000);
- sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
- id);
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- } else {
- /* we're owned, we're in a call, let's refuse */
- sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- skypiax_sleep(10000);
- DEBUGA_SKYPE
- ("We have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
- SKYPIAX_P_LOG, id);
+ if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
+ ERRORA("bind Error\n", SKYPIAX_P_LOG);
+ skypiax_close_socket(s);
+ return NULL;
+ }
+ DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
- }
- } else {
- /* we are calling out */
- tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
- tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
- //FIXME ast_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n",
- SKYPIAX_P_LOG, id);
- }
- } else if (!strcasecmp(value, "EARLYMEDIA")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
- tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- //FIXME ast_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
- DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n",
- SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "MISSED")) {
- DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
+ listen(s, 6);
- } else if (!strcasecmp(value, "FINISHED")) {
- //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
+ sin_size = sizeof(remote_addr);
+ while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
+ DEBUGA_SKYPE("ACCEPTED\n", SKYPIAX_P_LOG);
+ if (!running)
+ break;
+ while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
+ && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
+ || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
+ unsigned int fdselect;
+ int rt;
+ fd_set fs;
+ struct timeval to;
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
+ if (!running)
+ break;
+ fdselect = fd;
+ FD_ZERO(&fs);
+ FD_SET(fdselect, &fs);
+ to.tv_usec = 2000000; //2000 msec
+ to.tv_sec = 0;
- } else if (!strcasecmp(value, "CANCELLED")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
- DEBUGA_SKYPE
- ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
- SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
+ rt = select(fdselect + 1, NULL, &fs, NULL, &to);
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
- } else if (!strcasecmp(value, "FAILED")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
- DEBUGA_SKYPE
- ("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
- SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else if (!strcasecmp(value, "REFUSED")) {
- if (!strcasecmp(id, tech_pvt->skype_call_id)) {
- /* this is the id of the call we are in, probably we generated it */
- tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
- DEBUGA_SKYPE
- ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
- SKYPIAX_P_LOG, id);
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- tech_pvt->skype_call_id[0] = '\0';
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- /* we're here because were us that refused an incoming call */
- DEBUGA_SKYPE("we REFUSED skype_call %s\n", SKYPIAX_P_LOG, id);
+ if (rt > 0) {
- }
- } else if (!strcasecmp(value, "ROUTING")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
- tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "UNPLACED")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
- tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "INPROGRESS")) {
- char msg_to_skype[1024];
- tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_UP;
- DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
- sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
- tech_pvt->tcp_cli_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- start_audio_threads(tech_pvt);
- sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
- tech_pvt->tcp_srv_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ /* read from the pipe the audio frame we are supposed to send out */
+ got =
+ skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
+ SAMPLES_PER_FRAME * sizeof(short));
+ if (got != SAMPLES_PER_FRAME * sizeof(short)) {
+ WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
+ SAMPLES_PER_FRAME * sizeof(short));
+ }
- tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+ if (got == SAMPLES_PER_FRAME * sizeof(short)) {
+ if (SAMPLERATE_SKYPIAX == 8000) {
- if (!strlen(tech_pvt->session_uuid_str)) {
- DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
- new_inbound_channel(tech_pvt);
- } else {
- DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
- outbound_channel_answered(tech_pvt);
+ /* we're upsampling from 8khz to 16khz, cli_out will contain two times each sample from cli_in */
+ a = 0;
+ for (i = 0; i < got / sizeof(short); i++) {
+ cli_out[a] = cli_in[i];
+ a++;
+ cli_out[a] = cli_in[i];
+ a++;
+ }
+ got = got * 2;
+ } else if (SAMPLERATE_SKYPIAX == 16000) {
+ /* we're NOT upsampling, cli_out will contain just ALL samples from cli_in */
+ for (i = 0; i < got / sizeof(short); i++) {
+ cli_out[i] = cli_in[i];
}
-
} else {
- WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
- value);
+ ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
+ }
+ /* send the 16khz frame to the Skype client waiting for incoming audio */
+ len = send(fd, (char *) cli_out, got, 0);
+
+ if (len == -1) {
+ break;
+ } else if (len != got) {
+ ERRORA("len=%d\n", SKYPIAX_P_LOG, len);
+ skypiax_sleep(1000);
+ break;
}
- } //STATUS
- } //CALL
+ } else {
- /* the "numbered" messages that follows are used by the directory application, not yet ported */
- if (!strcasecmp(message, "#333")) {
- /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[11]: %s\n", SKYPIAX_P_LOG,
- * message_2, &message_2[11]); */
- memset(tech_pvt->skype_friends, 0, 4096);
- strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
- }
- if (!strcasecmp(message, "#222")) {
- /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
- * message_2, &message_2[10]); */
- memset(tech_pvt->skype_fullname, 0, 512);
- strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
- }
- if (!strcasecmp(message, "#765")) {
- /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
- * message_2, &message_2[10]); */
- memset(tech_pvt->skype_displayname, 0, 512);
- strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
+ WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
+ SAMPLES_PER_FRAME * sizeof(short));
+ }
+ } else {
+ if (rt)
+ ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
+ skypiax_sleep(10000);
}
- a = 0;
- } //message end
- } //read_from_pipe
+ }
+ DEBUGA_SKYPE("Skype outbound audio GONE\n", SKYPIAX_P_LOG);
+ skypiax_close_socket(fd);
+ break;
+ }
- return 0;
+ DEBUGA_SKYPE("outbound audio server (I am it) GONE\n", SKYPIAX_P_LOG);
+ skypiax_close_socket(s);
+ return NULL;
+}
+
+int skypiax_skypeaudio_read(private_t * tech_pvt)
+{
+ unsigned int samples;
+
+ samples =
+ skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data,
+ SAMPLES_PER_FRAME * sizeof(short));
+
+ if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
+ if (samples)
+ WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples,
+ SAMPLES_PER_FRAME * sizeof(short));
+ return 0;
+ } else {
+ /* A real frame */
+ tech_pvt->read_frame.datalen = samples;
+ }
+ return 1;
}
int skypiax_skype_senddigit(private_t * tech_pvt, char digit)
@@ -722,9 +663,7 @@
char msg_to_skype[1024];
DEBUGA_SKYPE("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
-
sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit);
-
skypiax_skype_write(tech_pvt, msg_to_skype);
return 0;
@@ -743,7 +682,6 @@
sprintf(msg_to_skype, "CALL %s", rdest);
if (skypiax_skype_write(tech_pvt, msg_to_skype) < 0) {
-
ERRORA("failed to communicate with Skype client, now exit\n", SKYPIAX_P_LOG);
return -1;
}
1
0
Author: gmaruzz
Date: Mon Feb 9 12:26:48 2009
New Revision: 11716
Log:
skypiax: skypiax_protocol.c indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Mon Feb 9 12:26:48 2009
@@ -339,387 +339,380 @@
memset(message, 0, 4096);
memset(message_2, 0, 4096);
- howmany =
- skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe,
- sizeof(read_from_pipe));
-
- a = 0;
- for (i = 0; i < howmany; i++) {
- message[a] = read_from_pipe[i];
- a++;
-
- if (read_from_pipe[i] == '\0') {
+ howmany =
+ skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe,
+ sizeof(read_from_pipe));
+
+ a = 0;
+ for (i = 0; i < howmany; i++) {
+ message[a] = read_from_pipe[i];
+ a++;
+
+ if (read_from_pipe[i] == '\0') {
+
+ DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
+
+ if (!strcasecmp(message, "ERROR 68")) {
+ DEBUGA_SKYPE
+ ("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
+ SKYPIAX_P_LOG);
+ skypiax_sleep(1000000);
+ skypiax_skype_write(tech_pvt, "PROTOCOL 6");
+ skypiax_sleep(10000);
+ return 0;
+ }
- DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
+ if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
+ ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
+ SKYPIAX_P_LOG, message);
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
+ DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+ tech_pvt->skype_call_id[0] = '\0';
+
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ }
- if (!strcasecmp(message, "ERROR 68")) {
- DEBUGA_SKYPE
- ("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
- SKYPIAX_P_LOG);
- skypiax_sleep(1000000);
- skypiax_skype_write(tech_pvt, "PROTOCOL 6");
- skypiax_sleep(10000);
- return 0;
- }
+ strncpy(message_2, message, sizeof(message) - 1);
- if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
- ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
- SKYPIAX_P_LOG, message);
- tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
- tech_pvt->skype_call_id[0] = '\0';
+ buf = message;
+ stringp = &buf;
+ where = strsep(stringp, " ");
+ if (!where) {
+ WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
+ }
+ if (!strcasecmp(message, "ERROR")) {
+ ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
+ DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+ tech_pvt->skype_call_id[0] = '\0';
+
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ }
+ if (!strcasecmp(message, "CURRENTUSERHANDLE")) {
+ strncpy(obj, where, sizeof(obj) - 1);
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
- }
+ where = strsep(stringp, " ");
- strncpy(message_2, message, sizeof(message) - 1);
+ strncpy(id, where, sizeof(id) - 1);
- buf = message;
- stringp = &buf;
- where = strsep(stringp, " ");
- if (!where) {
- WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
- }
- if (!strcasecmp(message, "ERROR")) {
- ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
- tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
- tech_pvt->skype_call_id[0] = '\0';
+ if (!strcasecmp(id, tech_pvt->skype_user)) {
+ tech_pvt->SkypiaxHandles.api_connected = 1;
+ DEBUGA_SKYPE
+ ("Skype MSG: message: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, tech_pvt->skype_user);
+ }
+ }
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
- }
- if (!strcasecmp(message, "CURRENTUSERHANDLE")) {
- strncpy(obj, where, sizeof(obj) - 1);
+ if (!strcasecmp(message, "USER")) {
+ strncpy(obj, where, sizeof(obj) - 1);
- where = strsep(stringp, " ");
+ where = strsep(stringp, " ");
- strncpy(id, where, sizeof(id) - 1);
+ strncpy(id, where, sizeof(id) - 1);
- if (!strcasecmp(id, tech_pvt->skype_user)) {
- tech_pvt->SkypiaxHandles.api_connected = 1;
- DEBUGA_SKYPE
- ("Skype MSG: message: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, tech_pvt->skype_user);
- }
- }
+ where = strsep(stringp, " ");
- if (!strcasecmp(message, "USER")) {
- strncpy(obj, where, sizeof(obj) - 1);
+ strncpy(prop, where, sizeof(prop) - 1);
- where = strsep(stringp, " ");
+ if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
+ char msg_to_skype[256];
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
- strncpy(id, where, sizeof(id) - 1);
+ //FIXME: TODO: allow authorization based on config param
+ sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ }
+ }
- where = strsep(stringp, " ");
+ if (!strcasecmp(message, "MESSAGE")) {
+ strncpy(obj, where, sizeof(obj) - 1);
- strncpy(prop, where, sizeof(prop) - 1);
+ where = strsep(stringp, " ");
- if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
- char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop);
+ strncpy(id, where, sizeof(id) - 1);
- //FIXME: TODO: allow authorization based on config param
- sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- }
- }
+ where = strsep(stringp, " ");
- if (!strcasecmp(message, "MESSAGE")) {
- strncpy(obj, where, sizeof(obj) - 1);
+ strncpy(prop, where, sizeof(prop) - 1);
- where = strsep(stringp, " ");
+ if (!strcasecmp(prop, "STATUS")) {
- strncpy(id, where, sizeof(id) - 1);
+ where = strsep(stringp, " ");
- where = strsep(stringp, " ");
+ strncpy(value, where, sizeof(value) - 1);
- strncpy(prop, where, sizeof(prop) - 1);
+ if (!strcasecmp(value, "RECEIVED")) {
+ char msg_to_skype[256];
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop, value);
+
+ //FIXME: TODO: allow authorization based on config param
+ sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ }
+ } else if (!strcasecmp(prop, "BODY")) {
+ char msg_to_skype[256];
- if (!strcasecmp(prop, "STATUS")) {
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
- where = strsep(stringp, " ");
+ //FIXME: TODO: on config param ???
+ sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ }
- strncpy(value, where, sizeof(value) - 1);
+ }
- if (!strcasecmp(value, "RECEIVED")) {
- char msg_to_skype[256];
- DEBUGA_SKYPE
- ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop, value);
+ if (!strcasecmp(message, "CALL")) {
- //FIXME: TODO: allow authorization based on config param
- sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- }
- } else if (!strcasecmp(prop, "BODY")) {
- char msg_to_skype[256];
+ strncpy(obj, where, sizeof(obj) - 1);
- DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop);
+ where = strsep(stringp, " ");
- //FIXME: TODO: on config param ???
- sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- }
+ strncpy(id, where, sizeof(id) - 1);
- }
+ where = strsep(stringp, " ");
- if (!strcasecmp(message, "CALL")) {
+ strncpy(prop, where, sizeof(prop) - 1);
- strncpy(obj, where, sizeof(obj) - 1);
+ where = strsep(stringp, " ");
- where = strsep(stringp, " ");
+ strncpy(value, where, sizeof(value) - 1);
- strncpy(id, where, sizeof(id) - 1);
+ where = strsep(stringp, " ");
- where = strsep(stringp, " ");
+ DEBUGA_SKYPE
+ ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
- strncpy(prop, where, sizeof(prop) - 1);
+ if (!strcasecmp(prop, "PARTNER_HANDLE")) {
+ strncpy(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1);
+ DEBUGA_SKYPE
+ ("the skype_call %s caller PARTNER_HANDLE (tech_pvt->callid_number) is: %s\n",
+ SKYPIAX_P_LOG, id, tech_pvt->callid_number);
+ return CALLFLOW_INCOMING_RING;
+ }
+ if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
+ snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s",
+ value, where ? " " : "", where ? where : "");
+ DEBUGA_SKYPE
+ ("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
+ SKYPIAX_P_LOG, id, tech_pvt->callid_name);
+ }
+ if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) {
+ DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG, id);
+ if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
+ tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
+ }
+ if (!strcasecmp(prop, "CONF_ID") && strcasecmp(value, "0")) {
+ DEBUGA_SKYPE("the skype_call %s is a conference call\n", SKYPIAX_P_LOG, id);
+ if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
+ tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
+ }
- where = strsep(stringp, " ");
+ if (!strcasecmp(prop, "DTMF")) {
- strncpy(value, where, sizeof(value) - 1);
+ DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
- where = strsep(stringp, " ");
+ dtmf_received(tech_pvt, value);
+ }
+ if (!strcasecmp(prop, "FAILUREREASON")) {
+ DEBUGA_SKYPE
+ ("Skype has FAILED on skype_call %s. Let's wait for the FAILED message.\n",
+ SKYPIAX_P_LOG, id);
+ }
+ if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
+ if (strcasecmp(id, tech_pvt->skype_call_id)) {
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
DEBUGA_SKYPE
- ("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
- SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
-
- if (!strcasecmp(prop, "PARTNER_HANDLE")) {
- strncpy(tech_pvt->callid_number, value,
- sizeof(tech_pvt->callid_number) - 1);
- DEBUGA_SKYPE
- ("the skype_call %s caller PARTNER_HANDLE (tech_pvt->callid_number) is: %s\n",
- SKYPIAX_P_LOG, id, tech_pvt->callid_number);
- return CALLFLOW_INCOMING_RING;
- }
- if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
- snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s",
- value, where ? " " : "", where ? where : "");
- DEBUGA_SKYPE
- ("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
- SKYPIAX_P_LOG, id, tech_pvt->callid_name);
- }
- if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) {
- DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG,
- id);
- if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
- tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
- }
- if (!strcasecmp(prop, "CONF_ID") && strcasecmp(value, "0")) {
- DEBUGA_SKYPE("the skype_call %s is a conference call\n", SKYPIAX_P_LOG, id);
- if (tech_pvt->interface_state == SKYPIAX_STATE_DOWN)
- tech_pvt->interface_state = SKYPIAX_STATE_PRERING;
- }
-
- if (!strcasecmp(prop, "DTMF")) {
-
- DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
+ ("We called a Skype contact and he answered us on skype_call: %s.\n",
+ SKYPIAX_P_LOG, id);
+ }
+ }
- dtmf_received(tech_pvt, value);
- }
+ if (!strcasecmp(prop, "STATUS")) {
- if (!strcasecmp(prop, "FAILUREREASON")) {
- DEBUGA_SKYPE
- ("Skype has FAILED on skype_call %s. Let's wait for the FAILED message.\n",
- SKYPIAX_P_LOG, id);
- }
- if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
- if (strcasecmp(id, tech_pvt->skype_call_id)) {
+ if (!strcasecmp(value, "RINGING")) {
+ char msg_to_skype[1024];
+ if (tech_pvt->interface_state != SKYPIAX_STATE_DIALING) {
+ /* we are not calling out */
+
+ if (!strlen(tech_pvt->skype_call_id)) { //FIXME
+ /* we are not inside an active call */
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
+ tech_pvt->interface_state = SKYPIAX_STATE_RING;
+ /* no owner, no active call, let's answer */
+ skypiax_skype_write(tech_pvt, "SET AGC OFF");
+ skypiax_sleep(10000);
+ skypiax_skype_write(tech_pvt, "SET AEC OFF");
+ skypiax_sleep(10000);
+ sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_sleep(10000);
+ sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_sleep(10000);
+ sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
+ id);
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ } else {
+ /* we're owned, we're in a call, let's refuse */
+ sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_sleep(10000);
DEBUGA_SKYPE
- ("We called a Skype contact and he answered us on skype_call: %s.\n",
+ ("We have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
SKYPIAX_P_LOG, id);
+
}
+ } else {
+ /* we are calling out */
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
+ tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
+ //FIXME ast_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n",
+ SKYPIAX_P_LOG, id);
}
+ } else if (!strcasecmp(value, "EARLYMEDIA")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
+ tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+ //FIXME ast_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
+ DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n",
+ SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "MISSED")) {
+ DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
+
+ } else if (!strcasecmp(value, "FINISHED")) {
+ //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
+ DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
- if (!strcasecmp(prop, "STATUS")) {
-
- if (!strcasecmp(value, "RINGING")) {
- char msg_to_skype[1024];
- if (tech_pvt->interface_state != SKYPIAX_STATE_DIALING) {
- /* we are not calling out */
-
- if (!strlen(tech_pvt->skype_call_id)) { //FIXME
- /* we are not inside an active call */
- tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
- tech_pvt->interface_state = SKYPIAX_STATE_RING;
- /* no owner, no active call, let's answer */
- skypiax_skype_write(tech_pvt, "SET AGC OFF");
- skypiax_sleep(10000);
- skypiax_skype_write(tech_pvt, "SET AEC OFF");
- skypiax_sleep(10000);
- sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- skypiax_sleep(10000);
- sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- skypiax_sleep(10000);
- sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n",
- SKYPIAX_P_LOG, id);
- strncpy(tech_pvt->skype_call_id, id,
- sizeof(tech_pvt->skype_call_id) - 1);
- } else {
- /* we're owned, we're in a call, let's refuse */
- sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- skypiax_sleep(10000);
- DEBUGA_SKYPE
- ("We have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
- SKYPIAX_P_LOG, id);
-
- }
- } else {
- /* we are calling out */
- tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
- tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
- //FIXME ast_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
- strncpy(tech_pvt->skype_call_id, id,
- sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n",
- SKYPIAX_P_LOG, id);
- }
- } else if (!strcasecmp(value, "EARLYMEDIA")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
- tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- //FIXME ast_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
- DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n",
- SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "MISSED")) {
- DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
-
- } else if (!strcasecmp(value, "FINISHED")) {
- //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
-
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
-
- } else if (!strcasecmp(value, "CANCELLED")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
- DEBUGA_SKYPE
- ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
- SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
-
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
- } else if (!strcasecmp(value, "FAILED")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
- DEBUGA_SKYPE
- ("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
- SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else if (!strcasecmp(value, "REFUSED")) {
- if (!strcasecmp(id, tech_pvt->skype_call_id)) {
- /* this is the id of the call we are in, probably we generated it */
- tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
- DEBUGA_SKYPE
- ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
- SKYPIAX_P_LOG, id);
- strncpy(tech_pvt->skype_call_id, id,
- sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- tech_pvt->skype_call_id[0] = '\0';
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- /* we're here because were us that refused an incoming call */
- DEBUGA_SKYPE("we REFUSED skype_call %s\n", SKYPIAX_P_LOG, id);
-
- }
- } else if (!strcasecmp(value, "ROUTING")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
- tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "UNPLACED")) {
- tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
- tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "INPROGRESS")) {
- char msg_to_skype[1024];
- tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_UP;
- DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
- sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
- tech_pvt->tcp_cli_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- start_audio_threads(tech_pvt);
- sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
- tech_pvt->tcp_srv_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
-
- tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
- if (!strlen(tech_pvt->session_uuid_str)) {
- DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
- new_inbound_channel(tech_pvt);
- } else {
- DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
- outbound_channel_answered(tech_pvt);
- }
+ } else if (!strcasecmp(value, "CANCELLED")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
+ DEBUGA_SKYPE
+ ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
+ SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
- } else {
- WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG,
- id, value);
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ } else if (!strcasecmp(value, "FAILED")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
+ DEBUGA_SKYPE
+ ("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
+ SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else if (!strcasecmp(value, "REFUSED")) {
+ if (!strcasecmp(id, tech_pvt->skype_call_id)) {
+ /* this is the id of the call we are in, probably we generated it */
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
+ DEBUGA_SKYPE
+ ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
+ SKYPIAX_P_LOG, id);
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ tech_pvt->skype_call_id[0] = '\0';
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ /* we're here because were us that refused an incoming call */
+ DEBUGA_SKYPE("we REFUSED skype_call %s\n", SKYPIAX_P_LOG, id);
- }
- } //STATUS
+ }
+ } else if (!strcasecmp(value, "ROUTING")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
+ tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "UNPLACED")) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
+ tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
+ } else if (!strcasecmp(value, "INPROGRESS")) {
+ char msg_to_skype[1024];
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_UP;
+ DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_cli_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ start_audio_threads(tech_pvt);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_srv_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+
+ tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+
+ if (!strlen(tech_pvt->session_uuid_str)) {
+ DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
+ new_inbound_channel(tech_pvt);
+ } else {
+ DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
+ outbound_channel_answered(tech_pvt);
+ }
- } //CALL
+ } else {
+ WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
+ value);
- /* the "numbered" messages that follows are used by the directory application, not yet ported */
- if (!strcasecmp(message, "#333")) {
- /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[11]: %s\n", SKYPIAX_P_LOG,
- * message_2, &message_2[11]); */
- memset(tech_pvt->skype_friends, 0, 4096);
- strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
- }
- if (!strcasecmp(message, "#222")) {
- /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
- * message_2, &message_2[10]); */
- memset(tech_pvt->skype_fullname, 0, 512);
- strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
- }
- if (!strcasecmp(message, "#765")) {
- /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
- * message_2, &message_2[10]); */
- memset(tech_pvt->skype_displayname, 0, 512);
- strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
}
+ } //STATUS
- a = 0;
- } //message end
- } //read_from_pipe
+ } //CALL
+ /* the "numbered" messages that follows are used by the directory application, not yet ported */
+ if (!strcasecmp(message, "#333")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[11]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[11]); */
+ memset(tech_pvt->skype_friends, 0, 4096);
+ strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
+ }
+ if (!strcasecmp(message, "#222")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[10]); */
+ memset(tech_pvt->skype_fullname, 0, 512);
+ strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
+ }
+ if (!strcasecmp(message, "#765")) {
+ /* DEBUGA_SKYPE("Skype MSG: message_2: %s, message2[10]: %s\n", SKYPIAX_P_LOG,
+ * message_2, &message_2[10]); */
+ memset(tech_pvt->skype_displayname, 0, 512);
+ strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
+ }
+
+ a = 0;
+ } //message end
+ } //read_from_pipe
return 0;
}
1
0