[asterisk-commits] wedhorn: branch wedhorn/skinny-subs r195443 - /team/wedhorn/skinny-subs/chann...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 18 16:57:18 CDT 2009
Author: wedhorn
Date: Mon May 18 16:57:14 2009
New Revision: 195443
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=195443
Log:
Cleanup of call ending.
Modified:
team/wedhorn/skinny-subs/channels/chan_skinny.c
Modified: team/wedhorn/skinny-subs/channels/chan_skinny.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/wedhorn/skinny-subs/channels/chan_skinny.c?view=diff&rev=195443&r1=195442&r2=195443
==============================================================================
--- team/wedhorn/skinny-subs/channels/chan_skinny.c (original)
+++ team/wedhorn/skinny-subs/channels/chan_skinny.c Mon May 18 16:57:14 2009
@@ -4815,7 +4815,7 @@
sub->autoans = 0;
sub->autoans_time = 3000;
sub->autoans_tone = 1;
- sub->endcalltonetime = 8000;
+ sub->endcalltonetime = 0;
sub->dialing = 0;
sub->hangingup = 0;
sub->locks = 0;
@@ -5406,7 +5406,6 @@
static void *skinny_thread_endcall(void *data)
{
struct skinny_subchannel *sub = data;
- struct skinny_device *d = sub->parent->device;
char sublabel[42];
sub->thread = pthread_self();
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
@@ -5414,23 +5413,9 @@
SKINNY_DEBUG(DEBUG_THREAD, ast_verb(3, "Starting hangup thread on %s (%p)\n", sublabel, (void *)pthread_self()))
pthread_cleanup_push(endcallThreadCleanupHandler, &sublabel);
- SIMPLE_LOCK_DEVICE;
- set_sub_state(sub, SUBSTATE_REORDER);
- SIMPLE_UNLOCK_DEVICE;
-
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
usleep(sub->endcalltonetime * 1000);
- while (1) {
- /* Loop until the device is hungup */
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
- //SIMPLE_LOCK_DEVICE;
- transmit_tone(sub->parent->device, SKINNY_ZIPZIP, sub->parent->instance, sub->callid);
- //SIMPLE_UNLOCK_DEVICE;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- usleep(1500000);
- }
- // Probably should destroy sub as it looks like the session has gone
- // Don't need to as long as session destroy kills all sub threads
+ set_sub_state(sub, SUBSTATE_ONHOOK);
pthread_cleanup_pop(0);
return NULL;
}
@@ -5587,9 +5572,6 @@
if (sub->owner) {
ast_queue_hangup(sub->owner);
detach_channel(sub);
- //sub->owner->tech_pvt = NULL;
- //skinny_unlock_chan_only(sub);
- //sub->owner = NULL;
}
if (sub != d->activesub || sub->substate == SUBSTATE_RINGIN || d->autohangup || sub->autohangup) {
sub->substate = SUBSTATE_ENDCALL;
@@ -5598,37 +5580,44 @@
sub->substate = SUBSTATE_ENDCALL;
transmit_activatecallplane(d, l);
stop_rtp(sub);
- sub->devstate = SKINNY_ONHOOK;
+ set_sub_state(sub, SUBSTATE_REORDER);
skinny_end_thread(sub);
- if (ast_pthread_create(&sub->thread, NULL, skinny_thread_endcall, sub)) {
- ast_log(LOG_WARNING, "Unable to create %s endcall thread: %s\n", sub->label, strerror(errno));
- set_sub_state(sub, SUBSTATE_ONHOOK);
- update_info = 0;
- break;
+ if (sub->endcalltonetime > 0) {
+ if (ast_pthread_create(&sub->thread, NULL, skinny_thread_endcall, sub)) {
+ ast_log(LOG_WARNING, "Unable to create %s endcall thread: %s\n", sub->label, strerror(errno));
+ set_sub_state(sub, SUBSTATE_ONHOOK);
+ update_info = 0;
+ break;
+ }
}
}
update_info = 0;
break;
- case SUBSTATE_HANGUP: /* The other side has hung up */
+/* case SUBSTATE_HANGUP:
sub->substate = SUBSTATE_HANGUP;
if (sub != d->activesub) {
set_sub_state(sub, SUBSTATE_ONHOOK);
} else if (d->autohangup || sub->autohangup) {
transmit_speaker_mode(d, SKINNY_SPEAKER_OFF);
+ set_sub_state(sub, SUBSTATE_ONHOOK);
} else {
transmit_activatecallplane(d, l);
stop_rtp(sub);
sub->devstate = SKINNY_ONHOOK;
+
+ set_sub_state(sub, SUBSTATE_REORDER);
+ if (sub->endcalltonetime) {
+ if (ast_pthread_create(&sub->thread, NULL, skinny_thread_endcall, sub)) {
+ ast_log(LOG_WARNING, "Unable to create %s endcall thread: %s\n", sub->label, strerror(errno));
+ set_sub_state(sub, SUBSTATE_ONHOOK);
+ update_info = 0;
+ break;
+ }
+ }
skinny_end_thread(sub);
- if (ast_pthread_create(&sub->thread, NULL, skinny_thread_endcall, sub)) {
- ast_log(LOG_WARNING, "Unable to create %s endcall thread: %s\n", sub->label, strerror(errno));
- set_sub_state(sub, SUBSTATE_ONHOOK);
- update_info = 0;
- break;
- }
}
update_info = 0;
- break;
+ break; */
case SUBSTATE_RINGOUT: /* Number has been dialed, trying to connect */
if ((sub->substate == SUBSTATE_OFFHOOK || sub->substate == SUBSTATE_PROGRESS) && sub == d->activesub) {
//if (!d->earlyrtp) {
More information about the asterisk-commits
mailing list