From: Igor Goncharovskiy Date: Wed, 5 Mar 2014 06:30:25 +0000 (+0000) Subject: Correct RTP handling in chan_unistim and fix transfer process broken in previous... X-Git-Tag: 12.2.0-rc1~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe17a176b4cbb3b74519543d334fe1aafcf8c135;p=thirdparty%2Fasterisk.git Correct RTP handling in chan_unistim and fix transfer process broken in previous fix: - Fixed too early RTP setup with phone, that cause no ringback tone on caller side - Handle call transfer cancel only in STATE_CALL case (related to ASTERISK-23073) (Reported by: Németh Tamás, niurkin sil) ........ Merged revisions 409761 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@409762 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index fa4f2c5c13..db8297e718 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -3169,6 +3169,11 @@ static void handle_call_incoming(struct unistimsession *s) ast_verb(0, "Handle Call Incoming for %s@%s\n", sub->parent->name, s->device->name); } + start_rtp(sub); + if (!sub->rtp) { + ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", sub->parent->name, s->device->name); + return; + } if (sub->owner) { ast_queue_control(sub->owner, AST_CONTROL_ANSWER); } @@ -4404,7 +4409,7 @@ static void process_request(int size, unsigned char *buf, struct unistimsession } if (memcmp(buf + SIZE_HEADER, packet_recv_pick_up, sizeof(packet_recv_pick_up)) == 0) { if (unistimdebug) { - ast_verb(0, "Handset off hook\n"); + ast_verb(0, "Handset off hook, current state: %s\n", ptestate_tostr(pte->state)); } if (!pte->device) { /* We are not yet registered (asking for a TN in AUTOPROVISIONING_TN) */ return; @@ -4430,7 +4435,7 @@ static void process_request(int size, unsigned char *buf, struct unistimsession } if (memcmp(buf + SIZE_HEADER, packet_recv_hangup, sizeof(packet_recv_hangup)) == 0) { if (unistimdebug) { - ast_verb(0, "Handset on hook\n"); + ast_verb(0, "Handset on hook, current state: %s\n", ptestate_tostr(pte->state)); } if (!pte->device) { return; @@ -4805,7 +4810,7 @@ static int unistim_hangup(struct ast_channel *ast) unistim_unalloc_sub(d, sub); return 0; } - if (sub_real && (sub_real->owner) && (sub->subtype == SUB_THREEWAY)) { /* 3way call cancelled by softkey pressed */ + if (sub_real && (sub_real->owner) && (sub->subtype == SUB_THREEWAY) && (s->state == STATE_CALL)) { /* 3way call cancelled by softkey pressed */ if (unistimdebug) { ast_verb(0, "Real call disconnected, stay in call\n"); } @@ -4893,9 +4898,6 @@ static int unistim_answer(struct ast_channel *ast) l = sub->parent; d = l->parent; - if ((!sub->rtp) && (!get_sub(d, SUB_THREEWAY))) { - start_rtp(sub); - } if (unistimdebug) { ast_verb(0, "unistim_answer(%s) on %s@%s-%d\n", ast_channel_name(ast), l->name, l->parent->name, sub->softkey); @@ -5224,7 +5226,9 @@ static int unistim_indicate(struct ast_channel *ast, int ind, const void *data, case AST_CONTROL_UPDATE_RTP_PEER: break; case AST_CONTROL_SRCCHANGE: - ast_rtp_instance_change_source(sub->rtp); + if (sub->rtp) { + ast_rtp_instance_change_source(sub->rtp); + } break; default: ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", ind); @@ -5836,14 +5840,7 @@ static struct ast_channel *unistim_request(const char *type, struct ast_format_c if (unistimdebug) { ast_verb(0, "unistim_request owner = %p\n", sub->owner); } - start_rtp(sub); - if (!sub->rtp) { - ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", sub->parent->name, d->name); - return NULL; - } - restart_monitor(); - /* and finish */ return tmpc; }