Freeswitch-svn
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
- 20 participants
- 764 discussions
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
Author: gmaruzz
Date: Mon Feb 9 12:26:31 2009
New Revision: 11715
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:31 2009
@@ -352,8 +352,7 @@
DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
- if (!strcasecmp(message, "ERROR 68")) { /* not yet protocol specified,
- just authorized */
+ 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);
@@ -386,25 +385,6 @@
if (!where) {
WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
}
-
- 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);
- }
if (!strcasecmp(message, "ERROR")) {
ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
@@ -716,6 +696,26 @@
} //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
1
0
Author: gmaruzz
Date: Mon Feb 9 12:10:52 2009
New Revision: 11714
Log:
skypiax: cleaning skypiax_protocol.c
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:10:52 2009
@@ -327,53 +327,32 @@
{
char read_from_pipe[4096];
- char messaggio[4096];
- char messaggio_2[4096];
+ char message[4096];
+ char message_2[4096];
char *buf, obj[512] = "", id[512] = "", prop[512] = "", value[512] = "", *where;
char **stringp = NULL;
- int rt;
int a;
unsigned int howmany;
unsigned int i;
-#ifndef WIN32
- int fdselect;
- fd_set fs;
- struct timeval to;
-#endif /* WIN32 */
memset(read_from_pipe, 0, 4096);
- memset(messaggio, 0, 4096);
- memset(messaggio_2, 0, 4096);
+ memset(message, 0, 4096);
+ memset(message_2, 0, 4096);
-#ifdef WIN32
- rt = 1;
-#else /* WIN32 */
- fdselect = tech_pvt->SkypiaxHandles.fdesc[0];
- FD_ZERO(&fs);
- FD_SET(fdselect, &fs);
- to.tv_usec = 2000000; //500 msec
- to.tv_sec = 0;
- rt = select(fdselect + 1, &fs, NULL, NULL, &to);
-#endif /* WIN32 */
-
- if (rt > 0) {
- if (tech_pvt->SkypiaxHandles.fdesc[0]) {
- howmany = sizeof(read_from_pipe);
howmany =
skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe,
- howmany);
+ sizeof(read_from_pipe));
a = 0;
for (i = 0; i < howmany; i++) {
- messaggio[a] = read_from_pipe[i];
+ message[a] = read_from_pipe[i];
a++;
if (read_from_pipe[i] == '\0') {
- //DEBUGA_SKYPE("read_skype: howmany=%d, i=%d, a=%d, |||%s||| \n", SKYPIAX_P_LOG, howmany, i, a, messaggio);
- DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, messaggio);
+ DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
- if (!strcasecmp(messaggio, "ERROR 68")) { /* not yet protocol specified,
+ if (!strcasecmp(message, "ERROR 68")) { /* not yet protocol specified,
just authorized */
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",
@@ -384,9 +363,9 @@
return 0;
}
- if (!strncasecmp(messaggio, "ERROR 92 CALL", 12)) {
+ if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
- SKYPIAX_P_LOG, messaggio);
+ 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';
@@ -399,35 +378,35 @@
}
}
- strncpy(messaggio_2, messaggio, sizeof(messaggio) - 1);
+ strncpy(message_2, message, sizeof(message) - 1);
- buf = messaggio;
+ buf = message;
stringp = &buf;
where = strsep(stringp, " ");
if (!where) {
- WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, messaggio);
+ WARNINGA("Skype MSG without spaces: %s\n", SKYPIAX_P_LOG, message);
}
- if (!strcasecmp(messaggio, "#333")) {
- /* DEBUGA_SKYPE("Skype MSG: messaggio_2: %s, messaggio2[11]: %s\n", SKYPIAX_P_LOG,
- * messaggio_2, &messaggio_2[11]); */
+ 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, &messaggio_2[11], 4095);
+ strncpy(tech_pvt->skype_friends, &message_2[11], 4095);
}
- if (!strcasecmp(messaggio, "#222")) {
- /* DEBUGA_SKYPE("Skype MSG: messaggio_2: %s, messaggio2[10]: %s\n", SKYPIAX_P_LOG,
- * messaggio_2, &messaggio_2[10]); */
+ 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, &messaggio_2[10], 511);
+ strncpy(tech_pvt->skype_fullname, &message_2[10], 511);
}
- if (!strcasecmp(messaggio, "#765")) {
- /* DEBUGA_SKYPE("Skype MSG: messaggio_2: %s, messaggio2[10]: %s\n", SKYPIAX_P_LOG,
- * messaggio_2, &messaggio_2[10]); */
+ 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, &messaggio_2[10], 511);
+ strncpy(tech_pvt->skype_displayname, &message_2[10], 511);
}
- if (!strcasecmp(messaggio, "ERROR")) {
- ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, messaggio);
+ 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';
@@ -439,7 +418,7 @@
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
}
}
- if (!strcasecmp(messaggio, "CURRENTUSERHANDLE")) {
+ if (!strcasecmp(message, "CURRENTUSERHANDLE")) {
strncpy(obj, where, sizeof(obj) - 1);
where = strsep(stringp, " ");
@@ -449,12 +428,12 @@
if (!strcasecmp(id, tech_pvt->skype_user)) {
tech_pvt->SkypiaxHandles.api_connected = 1;
DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, tech_pvt->skype_user);
+ ("Skype MSG: message: %s, currentuserhandle: %s, cuh: %s, skype_user: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, tech_pvt->skype_user);
}
}
- if (!strcasecmp(messaggio, "USER")) {
+ if (!strcasecmp(message, "USER")) {
strncpy(obj, where, sizeof(obj) - 1);
where = strsep(stringp, " ");
@@ -467,8 +446,8 @@
if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop);
+ DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
+ SKYPIAX_P_LOG, message, obj, id, prop);
//FIXME: TODO: allow authorization based on config param
sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
@@ -476,7 +455,7 @@
}
}
- if (!strcasecmp(messaggio, "MESSAGE")) {
+ if (!strcasecmp(message, "MESSAGE")) {
strncpy(obj, where, sizeof(obj) - 1);
where = strsep(stringp, " ");
@@ -496,8 +475,8 @@
if (!strcasecmp(value, "RECEIVED")) {
char msg_to_skype[256];
DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s value: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop, value);
+ ("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);
@@ -506,8 +485,8 @@
} else if (!strcasecmp(prop, "BODY")) {
char msg_to_skype[256];
- DEBUGA_SKYPE("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop);
+ 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);
@@ -516,7 +495,7 @@
}
- if (!strcasecmp(messaggio, "CALL")) {
+ if (!strcasecmp(message, "CALL")) {
strncpy(obj, where, sizeof(obj) - 1);
@@ -535,8 +514,8 @@
where = strsep(stringp, " ");
DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
+ ("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,
@@ -741,8 +720,6 @@
} //message end
} //read_from_pipe
- }
- }
return 0;
}
1
0
09 Feb '09
Author: mikej
Date: Mon Feb 9 11:56:38 2009
New Revision: 11713
Log:
use sofia specific flag macros
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Feb 9 11:56:38 2009
@@ -85,15 +85,15 @@
sofia_glue_tech_absorb_sdp(tech_pvt);
}
- if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
const char *var;
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !switch_strlen_zero(var)) {
if (switch_true(var) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_32)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
} else if (!strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_80)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND);
}
}
@@ -123,8 +123,8 @@
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -138,8 +138,8 @@
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -153,8 +153,8 @@
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -167,8 +167,8 @@
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
@@ -256,7 +256,7 @@
}
}
- if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
+ if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
const char *buuid;
switch_core_session_t *bsession;
switch_channel_t *bchannel;
@@ -279,7 +279,7 @@
switch_core_session_rwunlock(bsession);
}
}
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
sofia_glue_deactivate_rtp(tech_pvt);
@@ -305,7 +305,7 @@
- if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
+ if (tech_pvt->nh && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
char reason[128] = "";
switch_stream_handle_t stream = { 0 };
switch_event_header_t *hi;
@@ -337,7 +337,7 @@
switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
}
- if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_ANS)) {
if (!tech_pvt->got_bye) {
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
}
@@ -347,7 +347,7 @@
TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
} else {
- if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
if (!tech_pvt->got_bye) {
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
@@ -369,7 +369,7 @@
}
}
- switch_set_flag(tech_pvt, TFLAG_BYE);
+ sofia_set_flag(tech_pvt, TFLAG_BYE);
switch_safe_free(stream.data);
}
@@ -422,7 +422,7 @@
int is_proxy = 0;
char *sticky = NULL;
- if (switch_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
return SWITCH_STATUS_SUCCESS;
}
@@ -441,7 +441,7 @@
}
} else {
/* This if statement check and handles the 3pcc proxy mode */
- if ((tech_pvt->profile->pflags & PFLAG_3PCC_PROXY) && switch_test_flag(tech_pvt, TFLAG_3PCC)) {
+ if ((tech_pvt->profile->pflags & PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
/* Send the 200 OK */
nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
@@ -454,7 +454,7 @@
// Maybe we should timeout?
switch_mutex_unlock(tech_pvt->sofia_mutex);
- while(switch_channel_ready(channel) && !switch_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
+ while(switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
switch_cond_next();
}
@@ -464,8 +464,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
}
- if ((is_proxy && !b_sdp) || switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
- switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+ if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
if (is_proxy) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling proxy mode due to call answer with no bridge\n");
@@ -512,7 +512,7 @@
}
}
- if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
@@ -528,7 +528,7 @@
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
return SWITCH_STATUS_SUCCESS;
}
@@ -541,7 +541,7 @@
switch_assert(tech_pvt != NULL);
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
@@ -555,17 +555,17 @@
tech_pvt->video_read_frame.datalen = 0;
- if (switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->video_read_frame.datalen = 0;
- while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
+ while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
tech_pvt->video_read_frame.flags = SFF_NONE;
status = switch_rtp_zerocopy_read_frame(tech_pvt->video_rtp_session, &tech_pvt->video_read_frame, flags);
@@ -610,19 +610,19 @@
}
}
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
return SWITCH_STATUS_SUCCESS;
}
- if (!switch_test_flag(frame, SFF_CNG)) {
+ if (!sofia_test_flag(frame, SFF_CNG)) {
switch_rtp_write_frame(tech_pvt->video_rtp_session, frame);
}
@@ -637,12 +637,12 @@
switch_assert(tech_pvt != NULL);
- if (!(tech_pvt->profile->pflags & PFLAG_RUNNING)) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_RUNNING)) {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING);
return SWITCH_STATUS_FALSE;
}
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
@@ -655,23 +655,23 @@
}
tech_pvt->read_frame.datalen = 0;
- switch_set_flag_locked(tech_pvt, TFLAG_READING);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READING);
- if (switch_test_flag(tech_pvt, TFLAG_HUP) || switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
return SWITCH_STATUS_FALSE;
}
- if (switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->read_frame.datalen = 0;
- while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
+ while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
tech_pvt->read_frame.flags = SFF_NONE;
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
@@ -684,8 +684,8 @@
}
/* Fast PASS! */
- if (switch_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ if (sofia_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
*frame = &tech_pvt->read_frame;
return SWITCH_STATUS_SUCCESS;
}
@@ -702,7 +702,7 @@
size_t bytes = 0;
int frames = 1;
- if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+ if (!sofia_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
if (!tech_pvt->read_codec.implementation) {
*frame = NULL;
return SWITCH_STATUS_GENERR;
@@ -820,7 +820,7 @@
}
}
- switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
if (tech_pvt->read_frame.datalen == 0) {
*frame = NULL;
@@ -853,25 +853,25 @@
return SWITCH_STATUS_GENERR;
}
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
return SWITCH_STATUS_SUCCESS;
}
- if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+ if (sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
return SWITCH_STATUS_FALSE;
}
- switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
+ sofia_set_flag_locked(tech_pvt, TFLAG_WRITING);
- if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
+ if (!sofia_test_flag(frame, SFF_CNG) && !sofia_test_flag(frame, SFF_PROXY_PACKET)) {
if (tech_pvt->read_impl.encoded_bytes_per_packet) {
bytes = tech_pvt->read_impl.encoded_bytes_per_packet;
frames = ((int) frame->datalen / bytes);
@@ -884,7 +884,7 @@
tech_pvt->timestamp_send += samples;
switch_rtp_write_frame(tech_pvt->rtp_session, frame);
- switch_clear_flag_locked(tech_pvt, TFLAG_WRITING);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_WRITING);
return status;
}
@@ -907,8 +907,8 @@
break;
case SWITCH_SIG_KILL:
default:
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- switch_set_flag_locked(tech_pvt, TFLAG_HUP);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
+ sofia_set_flag_locked(tech_pvt, TFLAG_HUP);
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_kill_socket(tech_pvt->rtp_session);
@@ -979,7 +979,7 @@
{
const char *var;
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
}
}
break;
@@ -1062,7 +1062,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n",
switch_channel_get_name(channel), msg->string_arg);
tech_pvt->local_sdp_str = switch_core_session_strdup(session, msg->string_arg);
- switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
sofia_glue_do_invite(session);
}
break;
@@ -1078,7 +1078,7 @@
switch_channel_get_name(channel), tech_pvt->local_sdp_str);
- switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
sofia_glue_do_invite(session);
}
break;
@@ -1133,7 +1133,7 @@
case SWITCH_MESSAGE_INDICATE_HOLD:
{
- switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
if (!switch_strlen_zero(msg->string_arg)) {
char message[256] = "";
@@ -1145,7 +1145,7 @@
case SWITCH_MESSAGE_INDICATE_UNHOLD:
{
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
}
break;
@@ -1154,7 +1154,7 @@
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
}
@@ -1241,7 +1241,7 @@
SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
} else if (code == 302 && !switch_strlen_zero(msg->string_arg)) {
char * p = strchr(msg->string_arg, ' ');
@@ -1267,7 +1267,7 @@
nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
}
if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
}
@@ -1288,9 +1288,9 @@
char *sticky = NULL;
const char *val = NULL;
- if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_ANS) && !sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
/* Transmit 183 Progress with SDP */
@@ -1307,8 +1307,8 @@
}
}
} else {
- if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
- switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+ if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
@@ -1338,7 +1338,7 @@
switch_channel_mark_pre_answered(channel);
- if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
@@ -1574,9 +1574,9 @@
stream->write_function(stream, "CNG \t%d\n", profile->cng_pt);
stream->write_function(stream, "SESSION-TO \t%d\n", profile->session_timeout);
stream->write_function(stream, "MAX-DIALOG \t%d\n", profile->max_proceeding);
- stream->write_function(stream, "NOMEDIA \t%s\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
- stream->write_function(stream, "LATE-NEG \t%s\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
- stream->write_function(stream, "PROXY-MEDIA \t%s\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+ stream->write_function(stream, "NOMEDIA \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+ stream->write_function(stream, "LATE-NEG \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+ stream->write_function(stream, "PROXY-MEDIA \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
stream->write_function(stream, "AGGRESSIVENAT \t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
stream->write_function(stream, "STUN_ENABLED \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
stream->write_function(stream, "STUN_AUTO_DISABLE\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
@@ -1765,9 +1765,9 @@
stream->write_function(stream, "<CNG>%d</CNG>\n", profile->cng_pt);
stream->write_function(stream, "<SESSION-TO>%d</SESSION-TO>\n", profile->session_timeout);
stream->write_function(stream, "<MAX-DIALOG>%d</MAX-DIALOG>\n", profile->max_proceeding);
- stream->write_function(stream, "<NOMEDIA>%s</NOMEDIA>\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
- stream->write_function(stream, "<LATE-NEG>%s</LATE-NEG>\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
- stream->write_function(stream, "<PROXY-MEDIA>%s</PROXY-MEDIA>\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+ stream->write_function(stream, "<NOMEDIA>%s</NOMEDIA>\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+ stream->write_function(stream, "<LATE-NEG>%s</LATE-NEG>\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+ stream->write_function(stream, "<PROXY-MEDIA>%s</PROXY-MEDIA>\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
stream->write_function(stream, "<AGGRESSIVENAT>%s</AGGRESSIVENAT>\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
stream->write_function(stream, "<STUN_ENABLED>%s</STUN_ENABLED>\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
stream->write_function(stream, "<STUN_AUTO_DISABLE>%s</STUN_AUTO_DISABLE>\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
@@ -1920,9 +1920,9 @@
if (argv[2]) {
int is_true = switch_true(argv[2]);
if (is_true) {
- profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+ sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
} else {
- profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+ sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
}
}
@@ -1935,9 +1935,9 @@
if (argv[2]) {
int is_true = switch_true(argv[2]);
if (is_true) {
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
} else {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
}
}
@@ -2417,7 +2417,7 @@
tech_pvt->gateway_name = switch_core_session_strdup(nsession, gateway_ptr->name);
switch_channel_set_variable(nchannel, "sip_gateway_name", gateway_ptr->name);
- if (!switch_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
+ if (!sofia_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
}
@@ -2522,8 +2522,8 @@
caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest);
switch_channel_set_caller_profile(nchannel, caller_profile);
switch_channel_set_flag(nchannel, CF_OUTBOUND);
- switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
- switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+ sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
if (switch_channel_get_state(nchannel) == CS_NEW) {
switch_channel_set_state(nchannel, CS_INIT);
}
@@ -2572,7 +2572,7 @@
tech_pvt->video_rm_rate = 90000;
tech_pvt->video_codec_ms = 0;
switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
- switch_set_flag(tech_pvt, TFLAG_VIDEO);
+ sofia_set_flag(tech_pvt, TFLAG_VIDEO);
}
}
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Mon Feb 9 11:56:38 2009
@@ -595,6 +595,11 @@
#define sofia_clear_pflag(obj, flag) (obj)->pflags &= ~(flag)
#define sofia_copy_pflags(dest, src, flags) (dest)->pflags &= ~(flags); (dest)->pflags |= ((src)->pflags & (flags))
+#define sofia_set_flag_locked(obj, flag) switch_set_flag_locked(obj, flag)
+#define sofia_set_flag(obj, flag) switch_set_flag(obj, flag)
+#define sofia_clear_flag_locked(obj, flag) switch_clear_flag_locked(obj, flag)
+#define sofia_test_flag(obj, flag) switch_test_flag(obj, flag)
+
/* Function Prototypes */
/*************************************************************************************************************************************************************/
@@ -785,4 +790,3 @@
void sofia_sla_handle_sip_i_subscribe(nua_t *nua, const char *contact_str, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
void sofia_sla_handle_sip_r_subscribe(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
void sofia_sla_handle_sip_i_notify(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
-
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon Feb 9 11:56:38 2009
@@ -377,7 +377,7 @@
sofia_private->destroy_me = 22;
}
- if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
+ if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
sip_authorization_t const *authorization = NULL;
if (sip->sip_authorization) {
@@ -709,7 +709,7 @@
goto end;
}
- if (switch_test_flag(profile, TFLAG_TPORT_LOG)) {
+ if (sofia_test_flag(profile, TFLAG_TPORT_LOG)) {
tportlog = 1;
}
@@ -1226,7 +1226,7 @@
gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
gateway->register_password = switch_core_strdup(gateway->pool, password);
if (switch_true(caller_id_in_from)) {
- switch_set_flag(gateway, REG_FLAG_CALLERID);
+ sofia_set_flag(gateway, REG_FLAG_CALLERID);
}
register_transport = (char *) sofia_glue_transport2str(gateway->register_transport);
if (contact_params) {
@@ -1365,7 +1365,7 @@
/* you could change profile->foo here if it was a minor change like context or dialplan ... */
profile->rport_level = 1; /* default setting */
profile->acl_count = 0;
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
if (xprofiledomain) {
profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
@@ -1399,7 +1399,7 @@
profile->record_template = switch_core_strdup(profile->pool, val);;
} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media"))) {
if (switch_true(val)) {
- switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+ sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
} else {
switch_clear_flag(profile, TFLAG_INB_NOMEDIA);
}
@@ -1410,69 +1410,69 @@
}
} else if (!strcasecmp(var, "inbound-late-negotiation")) {
if (switch_true(val)) {
- switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+ sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
} else {
switch_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
}
} else if (!strcasecmp(var, "inbound-proxy-media")) {
if (switch_true(val)) {
- switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+ sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
} else {
switch_clear_flag(profile, TFLAG_PROXY_MEDIA);
}
} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_CALLID_AS_UUID;
+ sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID);
} else {
- profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+ sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
}
} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UUID_AS_CALLID;
+ sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
} else {
- profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+ sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
}
} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
} else {
- profile->pflags &= ~PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ sofia_clear_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
}
} else if (!strcasecmp(var, "aggressive-nat-detection")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+ sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
} else {
- profile->pflags &= ~PFLAG_AGGRESSIVE_NAT_DETECTION;
+ sofia_clear_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
}
} else if (!strcasecmp(var, "disable-rtp-auto-adjust")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+ sofia_set_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
} else {
- profile->pflags &= ~PFLAG_DISABLE_RTP_AUTOADJ;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
}
} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
+ sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
} else {
- profile->pflags &= ~PFLAG_DISABLE_SRTP_AUTH;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
}
} else if (!strcasecmp(var, "NDLB-funny-stun")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_FUNNY_STUN;
+ sofia_set_pflag(profile, PFLAG_FUNNY_STUN);
} else {
- profile->pflags &= ~PFLAG_FUNNY_STUN;
+ sofia_clear_pflag(profile, PFLAG_FUNNY_STUN);
}
} else if (!strcasecmp(var, "stun-enabled")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
} else {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
}
} else if (!strcasecmp(var, "stun-auto-disable")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+ sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
} else {
- profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+ sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
}
} else if (!strcasecmp(var, "apply-nat-acl")) {
if (profile->acl_count < SOFIA_MAX_ACL) {
@@ -1498,47 +1498,47 @@
}
} else if (!strcasecmp(var, "rfc2833-pt")) {
profile->te = (switch_payload_t) atoi(val);
- } else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ } else if (!strcasecmp(var, "cng-pt") && !(sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG))) {
profile->cng_pt = (switch_payload_t) atoi(val);
} else if (!strcasecmp(var, "vad")) {
if (!strcasecmp(val, "in")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
} else if (!strcasecmp(val, "out")) {
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (!strcasecmp(val, "both")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (strcasecmp(val, "none")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
} else if (!strcasecmp(var, "unregister-on-options-fail")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+ sofia_set_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
} else {
- profile->pflags &= ~PFLAG_UNREG_OPTIONS_FAIL;
+ sofia_clear_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
}
} else if (!strcasecmp(var, "require-secure-rtp")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SECURE;
+ sofia_set_pflag(profile, PFLAG_SECURE);
} else {
- profile->pflags &= ~PFLAG_SECURE;
+ sofia_clear_pflag(profile, PFLAG_SECURE);
}
} else if (!strcasecmp(var, "multiple-registrations")) {
if (!strcasecmp(val, "call-id")) {
- profile->pflags |= PFLAG_MULTIREG;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
} else if (!strcasecmp(val, "contact") || switch_true(val)) {
- profile->pflags |= PFLAG_MULTIREG;
- profile->pflags |= PFLAG_MULTIREG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
+ sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT);
} else if (switch_true(val)) {
- profile->pflags &= ~PFLAG_MULTIREG;
- //profile->pflags &= ~PFLAG_MULTIREG_CONTACT;
+ sofia_clear_pflag(profile, PFLAG_MULTIREG);
+ //sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT);
}
} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SUPPRESS_CNG;
+ sofia_set_pflag(profile, PFLAG_SUPPRESS_CNG);
profile->cng_pt = 0;
} else {
- profile->pflags &= ~PFLAG_SUPPRESS_CNG;
+ sofia_clear_pflag(profile, PFLAG_SUPPRESS_CNG);
}
} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
if (switch_true(val)) {
@@ -1554,33 +1554,33 @@
}
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_PASS_RFC2833;
+ sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
} else {
- profile->pflags &= ~PFLAG_PASS_RFC2833;
+ sofia_clear_pflag(profile, PFLAG_PASS_RFC2833);
}
} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
if (!strcasecmp(val, "greedy")) {
- profile->pflags |= PFLAG_GREEDY;
+ sofia_set_pflag(profile, PFLAG_GREEDY);
} else {
- profile->pflags &= ~PFLAG_GREEDY;
+ sofia_clear_pflag(profile, PFLAG_GREEDY);
}
} else if (!strcasecmp(var, "disable-transcoding")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+ sofia_set_pflag(profile, PFLAG_DISABLE_TRANSCODING);
} else {
- profile->pflags &= ~PFLAG_DISABLE_TRANSCODING;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_TRANSCODING);
}
} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+ sofia_set_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
} else {
- profile->pflags &= ~PFLAG_REWRITE_TIMESTAMPS;
+ sofia_clear_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
}
} else if (!strcasecmp(var, "auth-calls")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AUTH_CALLS;
+ sofia_set_pflag(profile, PFLAG_AUTH_CALLS);
} else {
- profile->pflags &= ~PFLAG_AUTH_CALLS;
+ sofia_clear_pflag(profile, PFLAG_AUTH_CALLS);
}
} else if (!strcasecmp(var, "force-register-domain")) {
profile->reg_domain = switch_core_strdup(profile->pool, val);
@@ -1800,8 +1800,8 @@
profile->tls_version = 0;
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
profile->rport_level = 1;
- profile->pflags |= PFLAG_STUN_ENABLED;
- profile->pflags |= PFLAG_DISABLE_100REL;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
+ sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
profile->auto_restart = 1;
profile->manage_shared_appearance = 0; /* Initialize default */
profile->disable_srv = 0;
@@ -1814,7 +1814,7 @@
if (!strcasecmp(var, "debug")) {
profile->debug = atoi(val);
} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
- switch_set_flag(profile, TFLAG_TPORT_LOG);
+ sofia_set_flag(profile, TFLAG_TPORT_LOG);
} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
#ifdef SWITCH_HAVE_ODBC
profile->odbc_dsn = switch_core_strdup(profile->pool, val);
@@ -1852,11 +1852,11 @@
} else if (!strcasecmp(var, "record-template")) {
profile->record_template = switch_core_strdup(profile->pool, val);
} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media")) && switch_true(val)) {
- switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+ sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
- switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+ sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
- switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+ sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
} else if (!strcasecmp(var, "force-subscription-expires")) {
int tmp = atoi(val);
if (tmp > 0) {
@@ -1864,56 +1864,56 @@
}
} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_CALLID_AS_UUID;
+ sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID);
} else {
- profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+ sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
}
} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UUID_AS_CALLID;
+ sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
} else {
- profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+ sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
}
} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
- profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
- profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+ sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
} else if (!strcasecmp(var, "disable-rtp-auto-adjust") && switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+ sofia_set_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth") && switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
+ sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
} else if (!strcasecmp(var, "NDLB-funny-stun")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_FUNNY_STUN;
+ sofia_set_pflag(profile, PFLAG_FUNNY_STUN);
} else {
- profile->pflags &= ~PFLAG_FUNNY_STUN;
+ sofia_clear_pflag(profile, PFLAG_FUNNY_STUN);
}
} else if (!strcasecmp(var, "stun-enabled")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
} else {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
}
} else if (!strcasecmp(var, "stun-auto-disable")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+ sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
} else {
- profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+ sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
}
} else if (!strcasecmp(var, "rfc2833-pt")) {
profile->te = (switch_payload_t) atoi(val);
- } else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ } else if (!strcasecmp(var, "cng-pt") && !sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG)) {
profile->cng_pt = (switch_payload_t) atoi(val);
} else if (!strcasecmp(var, "sip-port")) {
profile->sip_port = atoi(val);
} else if (!strcasecmp(var, "vad")) {
if (!strcasecmp(val, "in")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
} else if (!strcasecmp(val, "out")) {
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (!strcasecmp(val, "both")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (strcasecmp(val, "none")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
@@ -2036,25 +2036,25 @@
}
} else if (!strcasecmp(var, "unregister-on-options-fail")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+ sofia_set_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
}
} else if (!strcasecmp(var, "require-secure-rtp")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SECURE;
+ sofia_set_pflag(profile, PFLAG_SECURE);
}
} else if (!strcasecmp(var, "multiple-registrations")) {
if (!strcasecmp(val, "call-id")) {
- profile->pflags |= PFLAG_MULTIREG;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
} else if (!strcasecmp(val, "contact") || switch_true(val)) {
- profile->pflags |= PFLAG_MULTIREG;
- profile->pflags |= PFLAG_MULTIREG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
+ sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT);
} else if (switch_true(val)) {
- profile->pflags &= ~PFLAG_MULTIREG;
- //profile->pflags &= ~PFLAG_MULTIREG_CONTACT;
+ sofia_clear_pflag(profile, PFLAG_MULTIREG);
+ //sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT);
}
} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SUPPRESS_CNG;
+ sofia_set_pflag(profile, PFLAG_SUPPRESS_CNG);
profile->cng_pt = 0;
}
} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
@@ -2067,56 +2067,56 @@
}
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_PASS_RFC2833;
+ sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
}
} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
if (!strcasecmp(val, "greedy")) {
- profile->pflags |= PFLAG_GREEDY;
+ sofia_set_pflag(profile, PFLAG_GREEDY);
}
} else if (!strcasecmp(var, "disable-transcoding")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+ sofia_set_pflag(profile, PFLAG_DISABLE_TRANSCODING);
}
} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+ sofia_set_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
}
} else if (!strcasecmp(var, "auth-calls")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AUTH_CALLS;
+ sofia_set_pflag(profile, PFLAG_AUTH_CALLS);
}
} else if (!strcasecmp(var, "nonce-ttl")) {
profile->nonce_ttl = atoi(val);
} else if (!strcasecmp(var, "accept-blind-reg")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_BLIND_REG;
+ sofia_set_pflag(profile, PFLAG_BLIND_REG);
}
} else if (!strcasecmp(var, "enable-3pcc")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_3PCC;
+ sofia_set_pflag(profile, PFLAG_3PCC);
}
else if(!strcasecmp(val, "proxy")){
- profile->pflags |= PFLAG_3PCC_PROXY;
+ sofia_set_pflag(profile, PFLAG_3PCC_PROXY);
}
} else if (!strcasecmp(var, "accept-blind-auth")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_BLIND_AUTH;
+ sofia_set_pflag(profile, PFLAG_BLIND_AUTH);
}
} else if (!strcasecmp(var, "auth-all-packets")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AUTH_ALL;
+ sofia_set_pflag(profile, PFLAG_AUTH_ALL);
}
} else if (!strcasecmp(var, "full-id-in-dialplan")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_FULL_ID;
+ sofia_set_pflag(profile, PFLAG_FULL_ID);
}
} else if (!strcasecmp(var, "inbound-reg-force-matching-username")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_CHECKUSER;
+ sofia_set_pflag(profile, PFLAG_CHECKUSER);
}
} else if (!strcasecmp(var, "enable-timer")) {
if (!switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_TIMER;
+ sofia_set_pflag(profile, PFLAG_DISABLE_TIMER);
}
} else if (!strcasecmp(var, "minimum-session-expires")) {
profile->minimum_session_expires = atoi(val);
@@ -2126,7 +2126,7 @@
}
} else if (!strcasecmp(var, "enable-100rel")) {
if (switch_true(val)) {
- profile->pflags &= ~PFLAG_DISABLE_100REL;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_100REL);
}
} else if (!strcasecmp(var, "bitpacking")) {
if (!strcasecmp(val, "aal2")) {
@@ -2441,7 +2441,7 @@
gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
sofia_reg_release_gateway(gateway);
gateway->pinging = 0;
- } else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
+ } else if (sofia_test_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
char *sql;
time_t now = switch_epoch_time_now(NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
@@ -2495,11 +2495,11 @@
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- if (!switch_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
return;
}
- switch_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
const char *r_sdp = NULL;
@@ -2645,7 +2645,7 @@
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
if (switch_core_session_compare(session, other_session)) {
- switch_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE);
if (tech_pvt->rtp_session) {
@@ -2787,9 +2787,9 @@
if (r_sdp) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_channel_mark_pre_answered(channel);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
goto done;
@@ -2809,7 +2809,7 @@
} else {
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
- } else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
+ } else if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
} else {
if (sofia_glue_tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) {
@@ -2826,25 +2826,25 @@
nua_ack(nh, TAG_END());
break;
case nua_callstate_received:
- if (!switch_test_flag(tech_pvt, TFLAG_SDP)) {
- if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOMEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
goto done;
} else if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
- } else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
+ } else if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
@@ -2867,11 +2867,11 @@
sip_replaces_t *replaces;
su_home_t *home = NULL;
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
if (replaces_str) {
home = su_home_new(sizeof(*home));
switch_assert(home != NULL);
@@ -2891,8 +2891,8 @@
if (br_b) {
switch_ivr_uuid_bridge(br_a, br_b);
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
- switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_channel_hangup(channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
} else {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
@@ -2918,22 +2918,22 @@
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
goto done;
} else {
- if (profile->pflags & PFLAG_3PCC) {
+ if (sofia_test_pflag(profile, PFLAG_3PCC)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
sofia_glue_tech_choose_port(tech_pvt, 0);
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- switch_set_flag_locked(tech_pvt, TFLAG_3PCC);
+ sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
switch_channel_set_state(channel, CS_HIBERNATE);
nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
- } else if(profile->pflags & PFLAG_3PCC_PROXY){
+ TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+ } else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
//3PCC proxy mode delays the 200 OK until the call is answered
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
- switch_set_flag_locked(tech_pvt, TFLAG_3PCC);
+ sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
sofia_glue_tech_choose_port(tech_pvt, 0);
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
switch_channel_set_flag(channel, TFLAG_LATE_NEGOTIATION);
@@ -2947,9 +2947,9 @@
}
}
- } else if (tech_pvt && switch_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
+ } else if (tech_pvt && sofia_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
- switch_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
goto done;
} else {
ss_state = nua_callstate_completed;
@@ -3015,7 +3015,7 @@
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+ TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
launch_media_on_hold(session);
switch_core_session_rwunlock(other_session);
@@ -3027,13 +3027,13 @@
msg.string_arg = (char *) r_sdp;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
- if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
if (!switch_stristr("sendonly", r_sdp)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
}
} else if (switch_stristr("sendonly", r_sdp)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
}
@@ -3063,7 +3063,7 @@
goto done;
}
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reinvite RTP Error!\n");
is_ok = 0;
@@ -3082,7 +3082,7 @@
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+ TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
} else {
nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
}
@@ -3091,13 +3091,13 @@
break;
case nua_callstate_ready:
- if (r_sdp && switch_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
+ if (r_sdp && sofia_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
sdp_parser_t *parser;
sdp_session_t *sdp;
uint8_t match = 0;
int is_ok = 1;
- switch_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
if (tech_pvt->num_codecs) {
if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
@@ -3109,13 +3109,13 @@
}
if (match) {
- switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error!\n");
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RTP ERROR");
is_ok = 0;
}
- switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
} else {
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
is_ok = 0;
@@ -3134,7 +3134,7 @@
}
if (tech_pvt && nh == tech_pvt->nh2) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cheater Reinvite!\n");
- switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
tech_pvt->nh = tech_pvt->nh2;
tech_pvt->nh2 = NULL;
if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
@@ -3147,9 +3147,9 @@
}
if (channel) {
- if (switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
switch_channel_mark_answered(channel);
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@@ -3162,14 +3162,14 @@
goto done;
}
- if (!r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (!r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
r_sdp = (const char *) switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
}
- if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
- switch_set_flag_locked(tech_pvt, TFLAG_SDP);
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
switch_channel_mark_answered(channel);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
@@ -3202,7 +3202,7 @@
}
if (match) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
if (sofia_glue_activate_rtp(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
switch_channel_mark_answered(channel);
@@ -3211,15 +3211,15 @@
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
- if (switch_test_flag(tech_pvt, TFLAG_3PCC)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
/* Check if we are in 3PCC proxy mode, if so then set the flag to indicate we received the ack */
- if (profile->pflags & PFLAG_3PCC_PROXY ) {
+ if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY )) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
- switch_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+ sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
} else if (switch_channel_get_state(channel) == CS_HIBERNATE) {
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
switch_channel_set_state(channel, CS_INIT);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
}
}
goto done;
@@ -3236,15 +3236,15 @@
case nua_callstate_terminating:
if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
- } else if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ } else if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
break;
case nua_callstate_terminated:
- if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
- if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
+ if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
+ if (sofia_test_flag(tech_pvt, TFLAG_NOHUP)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
} else {
int cause;
if (tech_pvt->q850_cause) {
@@ -3325,7 +3325,7 @@
tuuid_str = switch_core_session_get_uuid(tsession);
switch_ivr_uuid_bridge(nhelper->bridge_to_uuid, tuuid_str);
switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
switch_core_session_rwunlock(tsession);
@@ -3397,7 +3397,7 @@
char *rep;
full_ref_to = sip_header_as_string(home, (void *) sip->sip_refer_to);
- if (profile->pflags & PFLAG_FULL_ID) {
+ if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
exten = switch_core_session_sprintf(session, "%s@%s", (char *) refer_to->r_url->url_user, (char *) refer_to->r_url->url_host);
} else {
exten = (char *) refer_to->r_url->url_user;
@@ -3472,8 +3472,8 @@
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
- switch_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
- switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_channel_set_variable(switch_core_session_get_channel(b_session), "park_timeout", "2");
switch_channel_set_state(switch_core_session_get_channel(b_session), CS_PARK);
@@ -3506,8 +3506,8 @@
private_object_t *h_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session);
t_session = switch_core_session_locate(br_b);
hup_channel = channel_a;
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
- switch_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
switch_channel_hangup(channel_b, SWITCH_CAUSE_ATTENDED_TRANSFER);
}
@@ -3894,7 +3894,7 @@
char *is_nat = NULL;
char *acl_token = NULL;
- if (sess_count >= sess_max || !(profile->pflags & PFLAG_RUNNING)) {
+ if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING)) {
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
return;
}
@@ -3914,7 +3914,7 @@
get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
- if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
if (sip && sip->sip_via) {
const char *port = sip->sip_via->v_port;
const char *host = sip->sip_via->v_host;
@@ -3970,13 +3970,13 @@
if (token) {
acl_token = strdup(token);
}
- if ((profile->pflags & PFLAG_AUTH_CALLS)) {
+ if (sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl \"%s[%s]\". Access Granted.\n",
network_ip, switch_str_nil(last_acl), switch_str_nil(acl_token));
is_auth = 1;
}
} else {
- if (!(profile->pflags & PFLAG_AUTH_CALLS)) {
+ if (!sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, switch_str_nil(last_acl));
nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
return;
@@ -3988,7 +3988,7 @@
}
if (!is_auth &&
- ((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
+ (sofia_test_pflag(profile, PFLAG_AUTH_CALLS) || (!sofia_test_pflag(profile, PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
calling_myself++;
} else {
@@ -4003,7 +4003,7 @@
}
if (sofia_endpoint_interface) {
- if (profile->pflags & PFLAG_CALLID_AS_UUID) {
+ if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) {
session = switch_core_session_request_uuid(sofia_endpoint_interface, NULL, sip->sip_call_id->i_id);
} else {
session = switch_core_session_request(sofia_endpoint_interface, NULL);
@@ -4152,7 +4152,7 @@
if (sip->sip_request->rq_url) {
const char *req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req);
- if (profile->pflags & PFLAG_FULL_ID) {
+ if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
destination_number = req_uri;
} else {
destination_number = sip->sip_request->rq_url->url_user;
@@ -4280,11 +4280,11 @@
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
- if (switch_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
switch_channel_set_flag(channel, CF_PROXY_MODE);
}
- if (switch_test_flag(tech_pvt, TFLAG_PROXY_MEDIA)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_PROXY_MEDIA)) {
switch_channel_set_flag(channel, CF_PROXY_MEDIA);
}
@@ -4422,8 +4422,8 @@
if (!one_leg &&
- (!b_tech_pvt || !switch_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) &&
- (!c_tech_pvt || !switch_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
+ (!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) &&
+ (!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
char *ext = switch_core_session_sprintf(b_session, "conference:%s@sla+flags{mintwo}", uuid);
switch_channel_set_flag(c_channel, CF_REDIRECT);
@@ -4462,13 +4462,13 @@
if (rpid) {
if (rpid->rpid_privacy) {
if (!strcasecmp(rpid->rpid_privacy, "yes")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(rpid->rpid_privacy, "full")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(rpid->rpid_privacy, "name")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
} else if (!strcasecmp(rpid->rpid_privacy, "number")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
} else {
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
@@ -4482,7 +4482,7 @@
if ((privacy = sip_privacy(sip))) {
if(msg_params_find(privacy->priv_values, "id")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
}
}
@@ -4595,7 +4595,7 @@
}
if (is_nat) {
- switch_set_flag(tech_pvt, TFLAG_NAT);
+ sofia_set_flag(tech_pvt, TFLAG_NAT);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Feb 9 11:56:38 2009
@@ -163,7 +163,7 @@
"m=audio %d RTP/%sAVP",
tech_pvt->owner_id, tech_pvt->session_id, family, ip, family, ip, port,
(!switch_strlen_zero(tech_pvt->local_crypto_key)
- && switch_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
+ && sofia_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
if (tech_pvt->rm_encoding) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
@@ -196,7 +196,7 @@
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
}
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
}
@@ -243,7 +243,7 @@
if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
if (!tech_pvt->rm_encoding) {
tech_pvt->cng_pt = 0;
@@ -260,7 +260,7 @@
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
}
- if (!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (!switch_strlen_zero(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
#if 0
@@ -294,7 +294,7 @@
#endif
}
- if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
!tech_pvt->local_sdp_video_port) {
sofia_glue_tech_choose_video_port(tech_pvt, 0);
@@ -419,7 +419,7 @@
}
if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
- if (!codec_string || (tech_pvt->profile->pflags & PFLAG_DISABLE_TRANSCODING)) {
+ if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
codec_string = ocodec;
} else {
if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
@@ -445,7 +445,7 @@
void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
{
- if (tech_pvt->num_codecs && !switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
+ if (tech_pvt->num_codecs && !sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
int i;
tech_pvt->video_count = 0;
for (i = 0; i < tech_pvt->num_codecs; i++) {
@@ -454,7 +454,7 @@
}
}
if (tech_pvt->video_count) {
- switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+ sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
}
}
}
@@ -486,7 +486,7 @@
tech_pvt->dtmf_type = profile->dtmf_type;
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
if (tech_pvt->bcng_pt) {
tech_pvt->cng_pt = tech_pvt->bcng_pt;
} else if (!tech_pvt->cng_pt) {
@@ -522,7 +522,7 @@
} else if (!strncasecmp(sourceip, "stun:", 5)) {
char *p;
- if (!(profile->pflags & PFLAG_STUN_ENABLED)) {
+ if (!sofia_test_pflag(profile, PFLAG_STUN_ENABLED)) {
*ip = switch_core_strdup(pool, tech_pvt->profile->rtpip);
return SWITCH_STATUS_SUCCESS;
}
@@ -544,7 +544,7 @@
}
for (x = 0; x < 5; x++) {
- if ((profile->pflags & PFLAG_FUNNY_STUN) ||
+ if (sofia_test_pflag(profile, PFLAG_FUNNY_STUN) ||
(tech_pvt && (var = switch_channel_get_variable(tech_pvt->channel, "funny_stun")) && switch_true(var))) {
error = "funny";
funny++;
@@ -568,8 +568,8 @@
if (tech_pvt) {
if (myport == *port && !strcmp(*ip, tech_pvt->profile->rtpip)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STUN Not Required ip and port match. [%s]:[%d]\n", *ip, *port);
- if (profile->pflags & PFLAG_STUN_AUTO_DISABLE) {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ if (sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE)) {
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STUN completely disabled.\n");
}
} else {
@@ -927,7 +927,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
} else {
- switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+ sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip,
@@ -1108,7 +1108,7 @@
switch_assert(tech_pvt != NULL);
- switch_clear_flag_locked(tech_pvt, TFLAG_SDP);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SDP);
caller_profile = switch_channel_get_caller_profile(channel);
@@ -1149,7 +1149,7 @@
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (!tech_pvt->nh) {
char *d_url = NULL, *url = NULL;
@@ -1264,7 +1264,7 @@
}
if (!(call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id"))) {
- if (tech_pvt->profile->pflags & PFLAG_UUID_AS_CALLID) {
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_UUID_AS_CALLID)) {
call_id = switch_core_session_get_uuid(session);
}
}
@@ -1280,7 +1280,7 @@
if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received")
|| ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) {
- switch_set_flag(tech_pvt, TFLAG_NAT);
+ sofia_set_flag(tech_pvt, TFLAG_NAT);
tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
route_uri = tech_pvt->record_route;
session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
@@ -1288,16 +1288,16 @@
}
/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
- if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
+ if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
priv = "name";
- if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
+ if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
priv = "full";
}
- } else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
+ } else if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
priv = "full";
}
- if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
+ if (sofia_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
screen = "yes";
}
@@ -1343,7 +1343,7 @@
free(e_dest);
}
- holdstr = switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
+ holdstr = sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
if (!switch_channel_get_variable(channel, "sofia_profile_name")) {
switch_channel_set_variable(channel, "sofia_profile_name", tech_pvt->profile->name);
@@ -1513,7 +1513,7 @@
{
int loops = 0;
if (switch_rtp_ready(tech_pvt->rtp_session)) {
- while (loops < 10 && (switch_test_flag(tech_pvt, TFLAG_READING) || switch_test_flag(tech_pvt, TFLAG_WRITING))) {
+ while (loops < 10 && (sofia_test_flag(tech_pvt, TFLAG_READING) || sofia_test_flag(tech_pvt, TFLAG_WRITING))) {
switch_yield(10000);
loops++;
}
@@ -1825,7 +1825,7 @@
}
if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
}
@@ -1834,7 +1834,7 @@
goto end;
}
- if (switch_rtp_ready(tech_pvt->rtp_session) && !switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ if (switch_rtp_ready(tech_pvt->rtp_session) && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
status = SWITCH_STATUS_SUCCESS;
goto end;
}
@@ -1865,23 +1865,23 @@
}
}
- if ((tech_pvt->profile->pflags & PFLAG_PASS_RFC2833)
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833)
|| ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
}
- if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
+ if (!(sofia_test_pflag(tech_pvt->profile, PFLAG_REWRITE_TIMESTAMPS) ||
((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && !switch_true(val)))) {
flags |= SWITCH_RTP_FLAG_RAW_WRITE;
}
- if (tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) {
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
tech_pvt->cng_pt = 0;
} else if (tech_pvt->cng_pt) {
flags |= SWITCH_RTP_FLAG_AUTO_CNG;
}
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
//const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
//const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
@@ -1910,8 +1910,8 @@
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+ if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) !=
SWITCH_STATUS_SUCCESS) {
@@ -1965,9 +1965,9 @@
(switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
if (switch_rtp_ready(tech_pvt->rtp_session)) {
- uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
- uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
- uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
+ uint8_t vad_in = sofia_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
+ uint8_t vad_out = sofia_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
+ uint8_t inb = sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
uint32_t stun_ping = 0;
if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_enable_vad_in")) && switch_true(val)) {
@@ -1997,14 +1997,14 @@
}
tech_pvt->ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
- switch_set_flag(tech_pvt, TFLAG_RTP);
- switch_set_flag(tech_pvt, TFLAG_IO);
+ sofia_set_flag(tech_pvt, TFLAG_RTP);
+ sofia_set_flag(tech_pvt, TFLAG_IO);
switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs);
if ((vad_in && inb) || (vad_out && !inb)) {
switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING);
- switch_set_flag(tech_pvt, TFLAG_VAD);
+ sofia_set_flag(tech_pvt, TFLAG_VAD);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP Engage VAD for %s ( %s %s )\n",
switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), vad_in ? "in" : "", vad_out ? "out" : "");
}
@@ -2069,12 +2069,12 @@
tech_pvt->cng_pt = 0;
}
- if (tech_pvt->cng_pt && !(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ if (tech_pvt->cng_pt && !sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", tech_pvt->cng_pt);
switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
}
- if (tech_pvt->remote_crypto_key && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (tech_pvt->remote_crypto_key && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key,
SWITCH_RTP_KEY_LEN);
@@ -2087,7 +2087,7 @@
sofia_glue_check_video_codecs(tech_pvt);
- if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
+ if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
if (!tech_pvt->local_sdp_video_port) {
sofia_glue_tech_choose_video_port(tech_pvt, 1);
}
@@ -2133,12 +2133,12 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
status = SWITCH_STATUS_FALSE;
goto end;
}
- switch_set_flag(tech_pvt, TFLAG_IO);
+ sofia_set_flag(tech_pvt, TFLAG_IO);
status = SWITCH_STATUS_SUCCESS;
end:
@@ -2182,7 +2182,7 @@
return SWITCH_STATUS_FALSE;
}
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_channel_mark_pre_answered(tech_pvt->channel);
return SWITCH_STATUS_SUCCESS;
}
@@ -2193,10 +2193,10 @@
void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
{
if (sendonly && switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) {
- if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *stream;
- switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
if (tech_pvt->max_missed_hold_packets) {
@@ -2219,13 +2219,13 @@
}
}
} else {
- if (switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_set_flag(tech_pvt, TFLAG_SIP_HOLD);
+ if (sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_set_flag(tech_pvt, TFLAG_SIP_HOLD);
}
- switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
- if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *uuid;
switch_core_session_t *b_session;
@@ -2249,7 +2249,7 @@
switch_core_session_rwunlock(b_session);
}
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
}
}
@@ -2273,7 +2273,7 @@
switch_assert(tech_pvt != NULL);
- greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
+ greedy = !!sofia_test_pflag(tech_pvt->profile, PFLAG_GREEDY);
if (!greedy) {
if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation")) && !strcasecmp(val, "greedy")) {
@@ -2406,7 +2406,7 @@
tech_pvt->remote_crypto_key = switch_core_session_strdup(tech_pvt->session, crypto);
tech_pvt->crypto_tag = crypto_tag;
- if (switch_rtp_ready(tech_pvt->rtp_session) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (switch_rtp_ready(tech_pvt->rtp_session) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
@@ -2498,7 +2498,7 @@
}
}
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
cng_pt = (switch_payload_t) map->rm_pt;
if (tech_pvt->rtp_session) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", cng_pt);
@@ -2700,7 +2700,7 @@
done:
tech_pvt->cng_pt = cng_pt;
- switch_set_flag_locked(tech_pvt, TFLAG_SDP);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
return match;
}
@@ -2779,11 +2779,11 @@
other_channel = switch_core_session_get_channel(other_session);
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
- if (!switch_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
+ if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND) &&
switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) {
switch_ivr_nomedia(val, SMF_FORCE);
- switch_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
}
switch_core_session_rwunlock(other_session);
}
@@ -2817,7 +2817,7 @@
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((profile = (sofia_profile_t *) switch_core_hash_find(mod_sofia_globals.profile_hash, key))) {
- if (!(profile->pflags & PFLAG_RUNNING)) {
+ if (!sofia_test_pflag(profile, PFLAG_RUNNING)) {
#ifdef SOFIA_DEBUG_RWLOCKS
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not running\n", profile->name);
#endif
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Mon Feb 9 11:56:38 2009
@@ -1447,7 +1447,7 @@
display = "\"user\"";
}
- if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
if (sip && sip->sip_via) {
const char *v_port = sip->sip_via->v_port;
const char *v_host = sip->sip_via->v_host;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Mon Feb 9 11:56:38 2009
@@ -765,7 +765,7 @@
switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
- if (is_nat && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
+ if (is_nat && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
}
@@ -793,7 +793,7 @@
authorization = sip->sip_proxy_authorization;
}
- if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && (profile->pflags & PFLAG_BLIND_REG))) {
+ if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && sofia_test_pflag(profile, PFLAG_BLIND_REG))) {
regtype = REG_REGISTER;
goto reg;
}
@@ -826,7 +826,7 @@
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
- if (*received_data && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
+ if (*received_data && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
}
@@ -1141,7 +1141,7 @@
goto end;
}
- if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
if (sip && sip->sip_via) {
const char *port = sip->sip_via->v_port;
const char *host = sip->sip_via->v_host;
@@ -1192,7 +1192,7 @@
}
}
- if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
+ if (ok && !sofia_test_pflag(profile, PFLAG_BLIND_REG)) {
type = REG_AUTO_REGISTER;
} else if (!ok) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, profile->reg_acl[x]);
@@ -1292,7 +1292,7 @@
private_object_t *tech_pvt;
switch_channel_t *channel = switch_core_session_get_channel(session);
- if ((tech_pvt = switch_core_session_get_private(session)) && switch_test_flag(tech_pvt, TFLAG_REFER)) {
+ if ((tech_pvt = switch_core_session_get_private(session)) && sofia_test_flag(tech_pvt, TFLAG_REFER)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received reply from REFER\n");
goto end;
}
@@ -1462,7 +1462,7 @@
}
/* Optional check that auth name == SIP username */
- if ((regtype == REG_REGISTER) && (profile->pflags & PFLAG_CHECKUSER)) {
+ if ((regtype == REG_REGISTER) && sofia_test_pflag(profile, PFLAG_CHECKUSER)) {
if (switch_strlen_zero(username) || switch_strlen_zero(to_user) || strcasecmp(to_user, username)) {
/* Names don't match, so fail */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP username %s does not match auth username\n", switch_str_nil(to_user));
@@ -1837,7 +1837,7 @@
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
- if (!(gateway->profile->pflags & PFLAG_RUNNING) || gateway->deleted) {
+ if (!sofia_test_pflag(gateway->profile, PFLAG_RUNNING) || gateway->deleted) {
gateway = NULL;
goto done;
}
1
0
Author: gmaruzz
Date: Mon Feb 9 11:35:00 2009
New Revision: 11712
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 11:35:00 2009
@@ -230,13 +230,13 @@
if (!running)
break;
- fdselect = fd;
+ 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);
+ rt = select(fdselect + 1, NULL, &fs, NULL, &to);
if (rt > 0) {
@@ -246,7 +246,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));
+ SAMPLES_PER_FRAME * sizeof(short));
}
if (got == SAMPLES_PER_FRAME * sizeof(short)) {
@@ -284,7 +284,7 @@
} else {
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- SAMPLES_PER_FRAME * sizeof(short));
+ SAMPLES_PER_FRAME * sizeof(short));
}
} else {
if (rt)
@@ -307,17 +307,19 @@
{
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;
- }
+ 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;
}
@@ -339,7 +341,6 @@
struct timeval to;
#endif /* WIN32 */
-
memset(read_from_pipe, 0, 4096);
memset(messaggio, 0, 4096);
memset(messaggio_2, 0, 4096);
@@ -387,7 +388,7 @@
ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
SKYPIAX_P_LOG, messaggio);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+ 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) {
@@ -428,7 +429,7 @@
if (!strcasecmp(messaggio, "ERROR")) {
ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, messaggio);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+ 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) {
@@ -533,9 +534,9 @@
where = strsep(stringp, " ");
- DEBUGA_SKYPE
- ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
- SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
+ DEBUGA_SKYPE
+ ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
+ SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
if (!strcasecmp(prop, "PARTNER_HANDLE")) {
strncpy(tech_pvt->callid_number, value,
@@ -579,9 +580,9 @@
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);
+ DEBUGA_SKYPE
+ ("We called a Skype contact and he answered us on skype_call: %s.\n",
+ SKYPIAX_P_LOG, id);
}
}
@@ -609,8 +610,8 @@
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);
+ 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 {
@@ -644,7 +645,7 @@
} 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);
+ 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) {
@@ -656,9 +657,9 @@
} 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);
+ 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) {
@@ -669,9 +670,9 @@
}
} 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);
+ 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;
@@ -680,9 +681,9 @@
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);
+ 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;
@@ -708,7 +709,7 @@
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);
+ 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);
@@ -815,6 +816,7 @@
return res;
}
+
int skypiax_skypeaudio_init(private_t * tech_pvt)
{
switch_status_t rv;
@@ -845,6 +847,7 @@
return res;
}
+
int skypiax_skypeaudio_init(private_t * tech_pvt)
{
if (pipe(tech_pvt->audiopipe)) {
@@ -863,7 +866,6 @@
}
#endif /* WIN32 */
-
#ifdef WIN32
enum {
@@ -917,7 +919,7 @@
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
sprintf(acInputRow, "%s", msg_to_skype);
- DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow);
+ DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow);
/* send command to skype */
oCopyData.dwData = 0;
oCopyData.lpData = acInputRow;
@@ -1105,7 +1107,6 @@
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
}
-
void *skypiax_do_skypeapi_thread_func(void *obj)
{
private_t *tech_pvt = obj;
@@ -1250,7 +1251,6 @@
}
-
int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles)
{
Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
@@ -1316,7 +1316,6 @@
Window root = -1;
Window win = -1;
-
if (!strlen(tech_pvt->X11_display))
strcpy(tech_pvt->X11_display, getenv("DISPLAY"));
@@ -1428,5 +1427,3 @@
}
#endif // WIN32
-
-
1
0
Author: gmaruzz
Date: Mon Feb 9 11:34:30 2009
New Revision: 11711
Log:
skypiax: cleaning skypiax_protocol.c
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 11:34:30 2009
@@ -303,34 +303,6 @@
return NULL;
}
-int skypiax_skypeaudio_init(private_t * tech_pvt)
-{
-
-#if defined(WIN32) && !defined(__CYGWIN__)
- switch_status_t rv;
- rv =
- switch_file_pipe_create(&tech_pvt->audiopipe[0], &tech_pvt->audiopipe[1],
- skypiax_module_pool);
- rv =
- switch_file_pipe_create(&tech_pvt->audioskypepipe[0], &tech_pvt->audioskypepipe[1],
- skypiax_module_pool);
-#else /* WIN32 */
- if (pipe(tech_pvt->audiopipe)) {
- fcntl(tech_pvt->audiopipe[0], F_SETFL, O_NONBLOCK);
- fcntl(tech_pvt->audiopipe[1], F_SETFL, O_NONBLOCK);
- }
- if (pipe(tech_pvt->audioskypepipe)) {
- fcntl(tech_pvt->audioskypepipe[0], F_SETFL, O_NONBLOCK);
- fcntl(tech_pvt->audioskypepipe[1], F_SETFL, O_NONBLOCK);
- }
-#endif /* WIN32 */
-
-/* this pipe is the audio fd for asterisk to poll on during a call. FS do not use it */
- tech_pvt->skypiax_sound_capt_fd = tech_pvt->audiopipe[0];
-
- return 0;
-}
-
int skypiax_skypeaudio_read(private_t * tech_pvt)
{
unsigned int samples;
@@ -843,7 +815,17 @@
return res;
}
-
+int skypiax_skypeaudio_init(private_t * tech_pvt)
+{
+ switch_status_t rv;
+ rv =
+ switch_file_pipe_create(&tech_pvt->audiopipe[0], &tech_pvt->audiopipe[1],
+ skypiax_module_pool);
+ rv =
+ switch_file_pipe_create(&tech_pvt->audioskypepipe[0], &tech_pvt->audioskypepipe[1],
+ skypiax_module_pool);
+ return 0;
+}
#else /* WIN32 */
int skypiax_pipe_read(int pipe, short *buf, int howmany)
{
@@ -863,6 +845,22 @@
return res;
}
+int skypiax_skypeaudio_init(private_t * tech_pvt)
+{
+ if (pipe(tech_pvt->audiopipe)) {
+ fcntl(tech_pvt->audiopipe[0], F_SETFL, O_NONBLOCK);
+ fcntl(tech_pvt->audiopipe[1], F_SETFL, O_NONBLOCK);
+ }
+ if (pipe(tech_pvt->audioskypepipe)) {
+ fcntl(tech_pvt->audioskypepipe[0], F_SETFL, O_NONBLOCK);
+ fcntl(tech_pvt->audioskypepipe[1], F_SETFL, O_NONBLOCK);
+ }
+
+/* this pipe is the audio fd for asterisk to poll on during a call. FS do not use it */
+ tech_pvt->skypiax_sound_capt_fd = tech_pvt->audiopipe[0];
+
+ return 0;
+}
#endif /* WIN32 */
1
0
Author: gmaruzz
Date: Mon Feb 9 11:25:07 2009
New Revision: 11710
Log:
skypiax: cleaning on Visual C
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.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 11:25:07 2009
@@ -948,8 +948,6 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load)
{
- private_t *tech_pvt = NULL; //for logging
-
skypiax_module_pool = pool;
memset(&globals, '\0', sizeof(globals));
1
0
Author: gmaruzz
Date: Mon Feb 9 11:23:01 2009
New Revision: 11709
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 11:23:01 2009
@@ -25,7 +25,6 @@
switch_mutex_t *mutex;
} globals;
-int option_debug = 100;
switch_endpoint_interface_t *skypiax_endpoint_interface;
switch_memory_pool_t *skypiax_module_pool = NULL;
int running = 0;
@@ -95,7 +94,6 @@
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session)
{
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
tech_pvt->read_frame.data = tech_pvt->databuf;
tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED,
@@ -111,7 +109,6 @@
DEBUGA_SKYPE("skypiax_codec SUCCESS\n", SKYPIAX_P_LOG);
}
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
}
/*
@@ -585,7 +582,6 @@
int res;
int forever = 1;
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG,
(void *) tech_pvt);
@@ -623,7 +619,6 @@
memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
}
}
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
return NULL;
}
@@ -971,7 +966,6 @@
skypiax_endpoint_interface->io_routines = &skypiax_io_routines;
skypiax_endpoint_interface->state_handler = &skypiax_state_handlers;
- DEBUGA_SKYPE("EXITING FUNC!\n", SKYPIAX_P_LOG);
if(running)
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
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 11:23:01 2009
@@ -11,10 +11,10 @@
extern switch_endpoint_interface_t *skypiax_endpoint_interface;
#endif /* ASTERISK */
-extern int option_debug;
extern int running;
/*************************************/
+/* suspicious globals FIXME */
#ifdef WIN32
DWORD win32_dwThreadId;
#else
@@ -45,9 +45,6 @@
short kill_cli_buff[SAMPLES_PER_FRAME];
short totalbuf[SAMPLES_PER_FRAME];
- if (option_debug > 100) {
- DEBUGA_SKYPE("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
memset(&my_addr, 0, sizeof(my_addr));
my_addr.sin_family = AF_INET;
my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */
@@ -55,17 +52,11 @@
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
ERRORA("socket Error\n", SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
ERRORA("bind Error\n", SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
@@ -183,9 +174,6 @@
DEBUGA_SKYPE("incoming audio server (I am it) GONE\n", SKYPIAX_P_LOG);
skypiax_close_socket(s);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -208,9 +196,6 @@
unsigned int sin_size;
#endif /* WIN32 */
- if (option_debug > 100) {
- DEBUGA_SKYPE("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
memset(&my_addr, 0, sizeof(my_addr));
my_addr.sin_family = AF_INET;
my_addr.sin_addr.s_addr = htonl(0x7f000001); /* use the localhost */
@@ -218,17 +203,11 @@
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
ERRORA("socket Error\n", SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
if (bind(s, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) < 0) {
ERRORA("bind Error\n", SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
skypiax_close_socket(s);
return NULL;
}
@@ -321,9 +300,6 @@
DEBUGA_SKYPE("outbound audio server (I am it) GONE\n", SKYPIAX_P_LOG);
skypiax_close_socket(s);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -391,9 +367,6 @@
struct timeval to;
#endif /* WIN32 */
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
memset(read_from_pipe, 0, 4096);
memset(messaggio, 0, 4096);
@@ -442,14 +415,10 @@
ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
SKYPIAX_P_LOG, messaggio);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- if (option_debug)
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) {
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
return CALLFLOW_INCOMING_HANGUP;
} else {
@@ -487,14 +456,10 @@
if (!strcasecmp(messaggio, "ERROR")) {
ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, messaggio);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- if (option_debug)
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) {
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
return CALLFLOW_INCOMING_HANGUP;
} else {
@@ -596,7 +561,6 @@
where = strsep(stringp, " ");
- if (option_debug > 101)
DEBUGA_SKYPE
("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
@@ -643,7 +607,6 @@
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);
- if (option_debug > 1)
DEBUGA_SKYPE
("We called a Skype contact and he answered us on skype_call: %s.\n",
SKYPIAX_P_LOG, id);
@@ -674,7 +637,6 @@
skypiax_sleep(10000);
sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
skypiax_skype_write(tech_pvt, msg_to_skype);
- if (option_debug)
DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n",
SKYPIAX_P_LOG, id);
strncpy(tech_pvt->skype_call_id, id,
@@ -710,14 +672,10 @@
} else if (!strcasecmp(value, "FINISHED")) {
//tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
- if (option_debug)
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) {
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
//tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
return CALLFLOW_INCOMING_HANGUP;
} else {
@@ -726,16 +684,12 @@
} else if (!strcasecmp(value, "CANCELLED")) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
- if (option_debug)
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) {
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
return CALLFLOW_INCOMING_HANGUP;
} else {
@@ -743,22 +697,17 @@
}
} else if (!strcasecmp(value, "FAILED")) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
- if (option_debug)
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;
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
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;
- if (option_debug)
DEBUGA_SKYPE
("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
SKYPIAX_P_LOG, id);
@@ -766,9 +715,6 @@
sizeof(tech_pvt->skype_call_id) - 1);
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
tech_pvt->skype_call_id[0] = '\0';
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return CALLFLOW_INCOMING_HANGUP;
} else {
/* we're here because were us that refused an incoming call */
@@ -825,19 +771,12 @@
}
}
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
- //DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
return 0;
}
int skypiax_skype_senddigit(private_t * tech_pvt, char digit)
{
char msg_to_skype[1024];
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
DEBUGA_SKYPE("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
@@ -845,9 +784,6 @@
skypiax_skype_write(tech_pvt, msg_to_skype);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -855,9 +791,6 @@
{
char msg_to_skype[1024];
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
skypiax_sleep(5000);
DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
skypiax_skype_write(tech_pvt, "SET AGC OFF");
@@ -869,9 +802,6 @@
if (skypiax_skype_write(tech_pvt, msg_to_skype) < 0) {
ERRORA("failed to communicate with Skype client, now exit\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
return 0;
@@ -988,11 +918,7 @@
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
sprintf(acInputRow, "%s", msg_to_skype);
- if (option_debug > 100)
DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow);
/* send command to skype */
oCopyData.dwData = 0;
@@ -1006,16 +932,10 @@
ERRORA
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then launch Skypiax and try again.\n",
SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
}
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -1319,24 +1239,15 @@
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
if (!skypiax_skype_send_message(SkypiaxHandles, msg_to_skype)) {
ERRORA
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n",
SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -1407,7 +1318,6 @@
Window root = -1;
Window win = -1;
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
if (!strlen(tech_pvt->X11_display))
strcpy(tech_pvt->X11_display, getenv("DISPLAY"));
@@ -1455,7 +1365,6 @@
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
SKYPIAX_P_LOG);
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
running = 0;
return NULL;
}
@@ -1465,7 +1374,6 @@
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
SKYPIAX_P_LOG);
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
running = 0;
return NULL;
}
@@ -1517,7 +1425,6 @@
running = 0;
return NULL;
}
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
running = 0;
return NULL;
1
0
09 Feb '09
Author: gmaruzz
Date: Mon Feb 9 11:22:53 2009
New Revision: 11708
Log:
skypiax: cleaning skypiax_protocol.c
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.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 Mon Feb 9 11:22:53 2009
@@ -180,16 +180,10 @@
{
struct skypiax_pvt *p = c->tech_pvt;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* queue the frame */
if (p)
p->control_to_send = control;
else {
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
DEBUGA_PBX("Queued CONTROL FRAME %d\n", SKYPIAX_P_LOG, control);
@@ -198,9 +192,6 @@
while (p->control_to_send)
usleep(1);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -210,14 +201,8 @@
char *name = data;
int res = AST_DEVICE_INVALID;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (!data) {
ERRORA("Devicestate requested with no data\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return res;
}
@@ -253,9 +238,6 @@
ERRORA("Checking device state for interface [%s] returning AST_DEVICE_INVALID\n",
SKYPIAX_P_LOG, name);
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return res;
}
@@ -268,9 +250,6 @@
struct skypiax_pvt *p = c->tech_pvt;
int res = 0;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
NOTICA("Let's INDICATE %d\n", SKYPIAX_P_LOG, cond);
switch (cond) {
@@ -296,9 +275,6 @@
res = -1;
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return res;
}
@@ -310,18 +286,12 @@
struct ast_channel *tmp = NULL;
char *name = data;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
DEBUGA_PBX("Try to request type: %s, name: %s, cause: %d," " format: %d\n",
SKYPIAX_P_LOG, type, name, *cause, format);
if (!data) {
ERRORA("Channel requested with no data\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -372,9 +342,6 @@
WARNINGA("Unable to create new Skypiax channel %s\n", SKYPIAX_P_LOG, name);
}
/* return the newly created channel */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return tmp;
}
@@ -390,15 +357,9 @@
/* if there is not skypiax pvt why we are here ? */
if (!p) {
ERRORA("Asked to hangup channel not connected\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (p->skype && p->interface_state != SKYPIAX_STATE_DOWN) {
char msg_to_skype[1024];
p->interface_state = SKYPIAX_STATE_HANGUP_REQUESTED;
@@ -457,26 +418,15 @@
/* set the channel state to DOWN, eg. available, not in active use */
if (ast_setstate(c, SKYPIAX_STATE_DOWN)) {
ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
- if (option_debug)
- DEBUGA_PBX("Hanged Up\n", SKYPIAX_P_LOG);
/* restart the monitor thread, so it can recheck which interfaces it have to watch during its loop (the interfaces that are not owned by channels) */
if (skypiax_restart_monitor()) {
ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -487,9 +437,6 @@
struct skypiax_pvt *p = c->tech_pvt;
int res;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* whle ringing, we just wait, the skype thread will answer */
while (p->interface_state == SKYPIAX_STATE_RING) {
usleep(10000); //10msec
@@ -498,13 +445,9 @@
ERRORA("call answering failed, we want it to be into interface_state=%d, got %d\n", SKYPIAX_P_LOG, SKYPIAX_STATE_UP, p->interface_state);
res = -1;
} else {
- if (option_debug)
DEBUGA_PBX("call answered\n", SKYPIAX_P_LOG);
res = 0;
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return res;
}
@@ -512,15 +455,9 @@
int skypiax_senddigit_begin(struct ast_channel *c, char digit)
{
struct skypiax_pvt *p = c->tech_pvt;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
DEBUGA_PBX("DIGIT BEGIN received: %c\n", SKYPIAX_P_LOG, digit);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -528,9 +465,6 @@
{
struct skypiax_pvt *p = c->tech_pvt;
char msg_to_skype[1024];
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
NOTICA("DIGIT END received: %c %d\n", SKYPIAX_P_LOG, digit, duration);
@@ -538,9 +472,6 @@
skypiax_skype_write(p, msg_to_skype);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
#else /* ASTERISK_VERSION_1_4 */
@@ -549,18 +480,12 @@
struct skypiax_pvt *p = c->tech_pvt;
char msg_to_skype[1024];
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
NOTICA("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
skypiax_skype_write(p, msg_to_skype);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -576,9 +501,6 @@
short *buf;
int samples;
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* if there are control frames queued to be sent by skypiax_queue_control, send it the first */
//TODO maybe better a real queue?
@@ -605,9 +527,6 @@
/* if the call is not active (ie: answered), do not send audio frames, they would pile up in a lag queue */
if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return &f;
}
@@ -632,10 +551,6 @@
skypiax_sound_boost(&f, p->capture_boost);
}
- if (option_debug > 100) {
- DEBUGA_SOUND("samples=%d\n", SKYPIAX_P_LOG, samples);
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return &f;
}
@@ -650,20 +565,13 @@
char *stringp = NULL;
int status;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if ((c->_state != SKYPIAX_STATE_DOWN)
&& (c->_state != SKYPIAX_STATE_RESERVED)) {
ERRORA("skypiax_call called on %s, neither down nor reserved\n", SKYPIAX_P_LOG,
c->name);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
- if (option_debug > 1)
DEBUGA_PBX("skypiax_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest,
timeout);
@@ -674,14 +582,10 @@
if (!where) {
ERRORA("Destination %s requires an actual destination (Skypiax/device/destination)\n",
SKYPIAX_P_LOG, idest);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
- if (option_debug > 1)
DEBUGA_PBX("skypiax_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
idest, timeout, dstr);
@@ -689,20 +593,13 @@
status = skypiax_skype_call(p, dstr, timeout);
if (status) {
WARNINGA("skypiax_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
- if (option_debug > 1)
DEBUGA_PBX("skypiax_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
idest, timeout, dstr);
ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -731,13 +628,7 @@
struct skypiax_pvt *p = c->tech_pvt;
int sent;
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
if (p->playback_boost)
@@ -746,10 +637,6 @@
sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
//skypiax_sound_write(p, f);
- if (option_debug > 100) {
- DEBUGA_SOUND("sent=%d\n", SKYPIAX_P_LOG, sent);
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -759,29 +646,17 @@
{
struct skypiax_pvt *p = newchan->tech_pvt;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (!p) {
ERRORA("No pvt after masquerade. Strange things may happen\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
if (p->owner != oldchan) {
ERRORA("old channel wasn't %p but was %p\n", SKYPIAX_P_LOG, oldchan, p->owner);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
p->owner = newchan;
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -789,9 +664,6 @@
{
struct ast_channel *tmp;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* alloc a generic channel struct */
#ifndef ASTERISK_VERSION_1_4
tmp = ast_channel_alloc(1);
@@ -858,9 +730,6 @@
ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
//ast_dsp_free(p->dsp);
ast_channel_free(tmp);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
/* if the requested state is different from DOWN, let the pbx manage this interface (now part of the newly created channel) */
@@ -869,9 +738,6 @@
if (ast_pbx_start(tmp)) {
ERRORA("Unable to start PBX on %s\n", SKYPIAX_P_LOG, tmp->name);
ast_channel_free(tmp);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
}
@@ -893,15 +759,9 @@
ast_update_use_count();
/* return the newly created channel */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return tmp;
}
ERRORA("failed memory allocation for Skypiax channel\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -927,10 +787,6 @@
struct ast_flags config_flags = { 0 };
#endif /* ASTERISK_VERSION_1_6 */
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- ast_log(LOG_DEBUG, "ENTERING FUNC\n");
- }
#if defined(WANT_SKYPE_X11) || defined(__CYGWIN__)
#ifndef __CYGWIN__
if (!XInitThreads())
@@ -949,9 +805,6 @@
i = ast_channel_register(&skypiax_tech);
if (i < 0) {
ERRORA("Unable to register channel type '%s'\n", SKYPIAX_P_LOG, skypiax_type);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
/* load skypiax.conf config file */
@@ -984,9 +837,6 @@
/* if error, unload config from memory and return */
ast_config_destroy(cfg);
ast_channel_unregister(&skypiax_tech);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
/* do it for each category described in config */
@@ -997,9 +847,6 @@
} else {
ERRORA("Unable to load skypiax_config skypiax.conf\n", SKYPIAX_P_LOG);
ast_channel_unregister(&skypiax_tech);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
#ifndef ASTERISK_VERSION_1_6
@@ -1008,14 +855,8 @@
/* start to monitor the interfaces (skypiax_iflist) for the first time */
if (skypiax_restart_monitor()) {
ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -1034,9 +875,6 @@
struct skypiax_pvt *p = NULL, *p2 = NULL;
int res;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* unregister our channel type with Asterisk */
ast_channel_unregister(&skypiax_tech);
@@ -1060,9 +898,6 @@
&& (skypiax_monitor_thread != AST_PTHREADT_STOP)) {
if (pthread_cancel(skypiax_monitor_thread)) {
ERRORA("pthread_cancel failed, BAD\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
if (pthread_kill(skypiax_monitor_thread, SIGURG)) {
@@ -1071,9 +906,6 @@
#ifndef __CYGWIN__ /* under cygwin, this seems to be not reliable, get stuck at times */
if (pthread_join(skypiax_monitor_thread, NULL)) {
ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
#endif /* __CYGWIN__ */
@@ -1128,9 +960,6 @@
sleep(5); /* without this pause, for some unknown (to me) reason it crashes on cygwin */
#endif /* __CYGWIN__ */
NOTICA("Unloaded Skypiax Module\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -1143,9 +972,6 @@
{
int res;
static struct skypiax_pvt *p = &skypiax_log_struct;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* lock the skypiax_usecnt lock */
LOKKA(&skypiax_usecnt_lock);
/* retrieve the skypiax_usecnt */
@@ -1153,9 +979,6 @@
/* unlock the skypiax_usecnt lock */
UNLOCKA(&skypiax_usecnt_lock);
/* return the skypiax_usecnt */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return res;
}
@@ -1166,13 +989,6 @@
*/
char *description()
{
- static struct skypiax_pvt *p = &skypiax_log_struct;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return (char *) skypiax_desc;
}
@@ -1184,16 +1000,9 @@
char *key()
{
struct skypiax_pvt *p = NULL;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
- if (option_debug)
NOTICA("Returning Key\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return ASTERISK_GPL_KEY;
}
@@ -1228,10 +1037,6 @@
/* alloc memory for PVT */
tmp = malloc(sizeof(struct skypiax_pvt));
if (tmp == NULL) { /* fail */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- ast_log(LOG_DEBUG, "EXITING FUNC\n");
- }
return NULL;
}
/* clear memory for PVT */
@@ -1399,9 +1204,6 @@
if (res == -1) {
ERRORA("Failed initializing sound device\n", SKYPIAX_TMP_LOG);
/* we failed, free the PVT */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- }
free(tmp);
return NULL;
}
@@ -1421,7 +1223,6 @@
tmp->skype_thread = AST_PTHREADT_NULL;
if (tmp->skype) {
- if (option_debug > 1)
ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
(unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
(unsigned long) AST_PTHREADT_NULL);
@@ -1429,21 +1230,14 @@
if (ast_pthread_create
(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- }
free(tmp);
return NULL;
}
#else /* __CYGWIN__ */
#ifdef WANT_SKYPE_X11
- if (option_debug > 1)
ast_log(LOG_DEBUG, "AsteriskHandlesfd: %d\n", tmp->SkypiaxHandles.fdesc[1]);
if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- }
free(tmp);
return NULL;
}
@@ -1452,13 +1246,9 @@
usleep(100000); //0.1 sec
if( tmp->skype_thread == AST_PTHREADT_NULL){
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- }
free(tmp);
return NULL;
}
- if (option_debug > 1)
ast_log(LOG_DEBUG, "STARTED skype_thread=%lu STOP=%lu NULL=%lu\n",
(unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
(unsigned long) AST_PTHREADT_NULL);
@@ -1516,9 +1306,6 @@
/* return the newly created skypiax_pvt */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- }
return tmp;
}
@@ -1527,14 +1314,8 @@
{
static struct skypiax_pvt *p = &skypiax_log_struct;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
/* If we're supposed to be stopped -- stay stopped */
if (skypiax_monitor_thread == AST_PTHREADT_STOP) {
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
LOKKA(&skypiax_monlock);
@@ -1542,9 +1323,6 @@
if (skypiax_monitor_thread == pthread_self()) {
UNLOCKA(&skypiax_monlock);
ERRORA("Cannot kill myself\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
/* if the monitor thread exists */
@@ -1556,16 +1334,10 @@
if (ast_pthread_create(&skypiax_monitor_thread, NULL, skypiax_do_monitor, NULL) < 0) {
UNLOCKA(&skypiax_monlock);
ERRORA("Unable to start monitor thread.\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
}
UNLOCKA(&skypiax_monlock);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
@@ -1582,14 +1354,8 @@
struct timeval to;
time_t now_timestamp;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -1657,9 +1423,6 @@
continue;
else {
ERRORA("select returned %d: %s\n", SKYPIAX_P_LOG, res, strerror(errno));
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
}
@@ -1694,9 +1457,6 @@
pthread_testcancel();
}
/* Never reached */
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -1712,12 +1472,6 @@
int skypiax_sound_init(struct skypiax_pvt *p)
{
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return skypiax_skypeaudio_init(p);
}
@@ -1733,14 +1487,8 @@
int skypiax_sound_shutdown(struct skypiax_pvt *p)
{
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
//return skypiax_portaudio_shutdown(p);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
}
@@ -1750,14 +1498,8 @@
struct ast_frame *f = NULL;
int res;
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
res = skypiax_skypeaudio_read(p);
f = &p->read_frame;
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return f;
}
@@ -1766,13 +1508,7 @@
{
int ret = -1;
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
ret = skypiax_skypeaudio_write(p, f);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return ret;
}
@@ -1785,16 +1521,10 @@
struct skypiax_pvt *p = data;
int res;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
DEBUGA_SERIAL("In skypiax_do_controldev_thread: started, p=%p\n", SKYPIAX_P_LOG, p);
if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -1804,7 +1534,6 @@
if (p->skype) {
res = skypiax_skype_read(p);
if (res == CALLFLOW_INCOMING_HANGUP) {
- if (option_debug)
DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
if (p->owner) {
pthread_testcancel();
@@ -1814,9 +1543,6 @@
}
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return NULL;
}
@@ -1835,14 +1561,8 @@
{
struct skypiax_pvt *p = NULL;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (sscanf(s, "%lf", boost) != 1) {
ERRORA("invalid boost <%s>\n", SKYPIAX_P_LOG, s);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return;
}
if (*boost < -BOOST_MAX) {
@@ -1853,7 +1573,6 @@
*boost = BOOST_MAX;
}
*boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
- if (option_debug > 1)
DEBUGA_SOUND("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
}
@@ -1863,38 +1582,23 @@
struct skypiax_pvt *skypiax_console_find_desc(char *dev)
{
struct skypiax_pvt *p = NULL;
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
for (p = skypiax_iflist; p && strcmp(p->name, dev) != 0; p = p->next);
if (p == NULL)
WARNINGA("could not find <%s>\n", SKYPIAX_P_LOG, dev);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return p;
}
int skypiax_console_playback_boost(int fd, int argc, char *argv[])
{
struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (argc > 2) {
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SHOWUSAGE;
}
if (!p) {
ast_cli(fd,
"No \"current\" skypiax_console for playback_boost, please enter 'help skypiax_console'\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -1911,30 +1615,18 @@
20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
int skypiax_console_capture_boost(int fd, int argc, char *argv[])
{
struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (argc > 2) {
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SHOWUSAGE;
}
if (!p) {
ast_cli(fd,
"No \"current\" skypiax_console for capture_boost, please enter 'help skypiax_console'\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -1951,9 +1643,6 @@
20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -1961,36 +1650,21 @@
{
struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (argc != 1) {
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SHOWUSAGE;
}
if (!p) {
ast_cli(fd,
"No \"current\" skypiax_console for hanging up, please enter 'help skypiax_console'\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
if (!p->owner) {
ast_cli(fd, "No call to hangup on the active skypiax_console, that is [%s]\n",
skypiax_console_active);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_FAILURE;
}
if (p->owner)
ast_queue_hangup(p->owner);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -1999,21 +1673,12 @@
char *s = NULL;
struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (argc != 2) {
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SHOWUSAGE;
}
if (!p) {
ast_cli(fd,
"No \"current\" skypiax_console for dialing, please enter 'help skypiax_console'\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -2027,9 +1692,6 @@
f.subclass = s[i];
ast_queue_frame(p->owner, &f);
}
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
} else
ast_cli(fd,
@@ -2037,9 +1699,6 @@
skypiax_console_active);
if (s)
free(s);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
int skypiax_console_set_active(int fd, int argc, char *argv[])
@@ -2093,9 +1752,6 @@
if (ast_pthread_create
(&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
} else {
DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
@@ -2105,9 +1761,6 @@
if (ast_pthread_create
(&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return -1;
} else {
DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
@@ -2230,14 +1883,8 @@
{
int sent;
- if (option_debug > 100) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
- if (option_debug > 100) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return 0;
}
int skypiax_console_skype(int fd, int argc, char *argv[])
@@ -2254,17 +1901,8 @@
"No \"current\" console for skypiax_skype, please enter 'help console'\n");
return RESULT_SUCCESS;
}
- if (option_debug > 10) {
- DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
- }
if (!p->skype) {
ast_cli(fd, "The \"current\" console is not connected to a Skype client'\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -2285,9 +1923,6 @@
break;
}
skypiax_skype_write(p, skype_msg);
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- }
return RESULT_SUCCESS;
}
@@ -2370,7 +2005,6 @@
} else {
snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
}
- if (option_debug)
NOTICA("Opening '%s'\n", SKYPIAX_P_LOG, fn);
time(&t);
ast_copy_string(date, ctime(&t), sizeof(date));
@@ -2382,14 +2016,12 @@
if (p->phonebook_writing_fp) {
if (add_to_skypiax_dir_conf) {
- if (option_debug)
NOTICA("Opened '%s' for appending \n", SKYPIAX_P_LOG, fn);
fprintf(p->phonebook_writing_fp, ";!\n");
fprintf(p->phonebook_writing_fp, ";! Update Date: %s", date);
fprintf(p->phonebook_writing_fp, ";! Updated by: %s, %d\n", __FILE__, __LINE__);
fprintf(p->phonebook_writing_fp, ";!\n");
} else {
- if (option_debug)
NOTICA("Opened '%s' for writing \n", SKYPIAX_P_LOG, fn);
fprintf(p->phonebook_writing_fp, ";!\n");
fprintf(p->phonebook_writing_fp, ";! Automatically generated configuration file\n");
1
0
[commit] r11707 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
by FreeSWITCH SVN 09 Feb '09
by FreeSWITCH SVN 09 Feb '09
09 Feb '09
Author: gmaruzz
Date: Mon Feb 9 10:56:44 2009
New Revision: 11707
Log:
skypiax: cleaning skypiax_protocol.c
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
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 Mon Feb 9 10:56:44 2009
@@ -405,6 +405,16 @@
int outbound_channel_answered(private_t *tech_pvt);
int skypiax_skype_senddigit(struct skypiax_pvt *p, char digit);
int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
+/* Visual C do not have strsep ? */
+char *strsep(char **stringp, const char *delim);
+#else
+int skypiax_pipe_read(int pipe, short *buf, int howmany);
+int skypiax_pipe_write(int pipe, short *buf, int howmany);
+#endif /* WIN32 */
+int skypiax_close_socket(unsigned int fd);
#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/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Mon Feb 9 10:56:44 2009
@@ -259,5 +259,13 @@
int new_inbound_channel(private_t *tech_pvt);
int outbound_channel_answered(private_t *tech_pvt);
int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
/* Visual C do not have strsep ? */
char *strsep(char **stringp, const char *delim);
+#else
+int skypiax_pipe_read(int pipe, short *buf, int howmany);
+int skypiax_pipe_write(int pipe, short *buf, int howmany);
+#endif /* WIN32 */
+int skypiax_close_socket(unsigned int fd);
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 10:56:44 2009
@@ -7,8 +7,6 @@
extern char *skypiax_console_active;
#else /* FREESWITCH */
#define skypiax_sleep switch_sleep
-//#define skypiax_pipe_write switch_file_write
-//#define skypiax_pipe_read switch_file_read
extern switch_memory_pool_t *skypiax_module_pool;
extern switch_endpoint_interface_t *skypiax_endpoint_interface;
#endif /* ASTERISK */
@@ -17,76 +15,14 @@
extern int running;
/*************************************/
-#ifndef WIN32
+#ifdef WIN32
+DWORD win32_dwThreadId;
+#else
XErrorHandler old_handler = 0;
int xerror = 0;
-#else
-DWORD win32_dwThreadId;
#endif /* WIN32 */
/*************************************/
-#if defined(WIN32) && !defined(__CYGWIN__)
-int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
-{
- switch_size_t quantity;
-
- quantity = howmany;
-
- switch_file_read(pipe, buf, &quantity);
-
- howmany = quantity;
-
- return howmany;
-}
-#else /* WIN32 */
-int skypiax_pipe_read(int pipe, short *buf, int howmany)
-{
- howmany = read(pipe, buf, howmany);
- return howmany;
-}
-#endif /* WIN32 */
-
-#if defined(WIN32) && !defined(__CYGWIN__)
-int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
-{
- switch_size_t quantity;
-
- quantity = howmany;
-
- switch_file_write(pipe, buf, &quantity);
-
- howmany = quantity;
-
- return howmany;
-}
-#else /* WIN32 */
-int skypiax_pipe_write(int pipe, short *buf, int howmany)
-{
- howmany = write(pipe, buf, howmany);
- return howmany;
-}
-#endif /* WIN32 */
-
-#if defined(WIN32) && !defined(__CYGWIN__)
-int skypiax_close_socket(unsigned int fd)
-{
- int res;
-
- res = closesocket(fd);
-
- return res;
-}
-#else /* WIN32 */
-int skypiax_close_socket(unsigned int fd)
-{
- int res;
-
- res = close(fd);
-
- return res;
-}
-#endif /* WIN32 */
-
void *skypiax_do_tcp_srv_thread_func(void *obj)
{
private_t *tech_pvt = obj;
@@ -941,6 +877,63 @@
return 0;
}
+/***************************/
+/* PLATFORM SPECIFIC */
+/***************************/
+#if defined(WIN32) && !defined(__CYGWIN__)
+int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
+{
+ switch_size_t quantity;
+
+ quantity = howmany;
+
+ switch_file_read(pipe, buf, &quantity);
+
+ howmany = quantity;
+
+ return howmany;
+}
+int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
+{
+ switch_size_t quantity;
+
+ quantity = howmany;
+
+ switch_file_write(pipe, buf, &quantity);
+
+ howmany = quantity;
+
+ return howmany;
+}
+int skypiax_close_socket(unsigned int fd)
+{
+ int res;
+
+ res = closesocket(fd);
+
+ return res;
+}
+
+#else /* WIN32 */
+int skypiax_pipe_read(int pipe, short *buf, int howmany)
+{
+ howmany = read(pipe, buf, howmany);
+ return howmany;
+}
+int skypiax_pipe_write(int pipe, short *buf, int howmany)
+{
+ howmany = write(pipe, buf, howmany);
+ return howmany;
+}
+int skypiax_close_socket(unsigned int fd)
+{
+ int res;
+
+ res = close(fd);
+
+ return res;
+}
+#endif /* WIN32 */
#ifdef WIN32
1
0