Fix device call logging issues in skinny
authorDamien Wedhorn <voip@facts.com.au>
Mon, 21 Jan 2013 07:26:04 +0000 (07:26 +0000)
committerDamien Wedhorn <voip@facts.com.au>
Mon, 21 Jan 2013 07:26:04 +0000 (07:26 +0000)
Skinny device call logging (ie missed, place and received calls) has issues
because the incorrect sequence of callstates is/can be sent to the device.
This patch removes some extra callstate updates driven by forces external
to skinny and ensures the needed intermediary callstate messages are sent.

(closes issue ASTERISK-20964)
Reported by: wedhorn
Tested by: snuffy, myself
Patches:
    ast11-skinny-calllog01.diff uploaded by wedhorn (license 5019)
........

Merged revisions 379677 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379678 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_skinny.c

index 01ed1b3..570bf28 100644 (file)
@@ -3125,25 +3125,6 @@ static void update_connectedline(struct skinny_subchannel *sub, const void *data
        SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Updating\n", sub->callid);
 
        send_callinfo(sub);
-       if (ast_channel_state(sub->owner) == AST_STATE_UP) {
-               transmit_callstate(d, l->instance, sub->callid, SKINNY_CONNECTED);
-               transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
-       } else {
-               if (sub->calldirection == SKINNY_INCOMING) {
-                       transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGIN);
-                       transmit_displaypromptstatus(d, "Ring-In", 0, l->instance, sub->callid);
-               } else {
-                       if (!sub->ringing) {
-                               transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGOUT);
-                               transmit_displaypromptstatus(d, "Ring-Out", 0, l->instance, sub->callid);
-                               sub->ringing = 1;
-                       } else {
-                               transmit_callstate(d, l->instance, sub->callid, SKINNY_PROGRESS);
-                               transmit_displaypromptstatus(d, "Call Progress", 0, l->instance, sub->callid);
-                               sub->progress = 1;
-                       }
-               }
-       }
 }
 
 static void mwi_event_cb(const struct ast_event *event, void *userdata)
@@ -5265,6 +5246,9 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
                        ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_RINGOUT from %s (on call-%d)\n", substate2str(sub->substate), sub->callid);
                        return;
                }
+               if (sub->substate != SUBSTATE_PROGRESS) {
+                       transmit_callstate(d, l->instance, sub->callid, SKINNY_PROGRESS);
+               }
 
                if (!d->earlyrtp) {
                        transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
@@ -5308,6 +5292,9 @@ static void setsubstate(struct skinny_subchannel *sub, int state)
                sub->substate = SUBSTATE_CALLWAIT;
                break;
        case SUBSTATE_CONNECTED:
+               if (sub->substate == SUBSTATE_RINGIN) {
+                       transmit_callstate(d, l->instance, sub->callid, SKINNY_OFFHOOK);
+               }
                if (sub->substate == SUBSTATE_HOLD) {
                        ast_queue_control(sub->owner, AST_CONTROL_UNHOLD);
                        transmit_connect(d, sub);