[asterisk-commits] mvanbaak: branch mvanbaak/ast_frame_dataunion r117213 - in /team/mvanbaak/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 19 15:51:35 CDT 2008


Author: mvanbaak
Date: Mon May 19 15:51:34 2008
New Revision: 117213

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117213
Log:
- apply patch from bugtracker
- alter ast_frame member as per Kevins suggestion
- Replace ast_queue_hangup_with_cause where the cause parameter is -1 to ast_queue_hangup because that function will stay
- ast_queue_hangup_with_cause already uses the named union member. Now for the rest to be fixed ...

Modified:
    team/mvanbaak/ast_frame_dataunion/apps/app_alarmreceiver.c
    team/mvanbaak/ast_frame_dataunion/apps/app_dial.c
    team/mvanbaak/ast_frame_dataunion/apps/app_disa.c
    team/mvanbaak/ast_frame_dataunion/apps/app_externalivr.c
    team/mvanbaak/ast_frame_dataunion/apps/app_followme.c
    team/mvanbaak/ast_frame_dataunion/apps/app_milliwatt.c
    team/mvanbaak/ast_frame_dataunion/apps/app_queue.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_alsa.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_console.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_gtalk.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_h323.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_iax2.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_jingle.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_local.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_mgcp.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_misdn.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_oss.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_sip.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_skinny.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_unistim.c
    team/mvanbaak/ast_frame_dataunion/channels/chan_zap.c
    team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c
    team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c
    team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c
    team/mvanbaak/ast_frame_dataunion/include/asterisk/channel.h
    team/mvanbaak/ast_frame_dataunion/include/asterisk/frame.h
    team/mvanbaak/ast_frame_dataunion/main/app.c
    team/mvanbaak/ast_frame_dataunion/main/audiohook.c
    team/mvanbaak/ast_frame_dataunion/main/channel.c

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_alarmreceiver.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_alarmreceiver.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_alarmreceiver.c Mon May 19 15:51:34 2008
@@ -252,8 +252,8 @@
 
 		/* If they hung up, leave */
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
-			if (f->seqno) {
-				chan->hangupcause = f->seqno;
+			if (f->data_int) {
+				chan->hangupcause = f->data_int;
 			}
 			ast_frfree(f);
 			res = -1;

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_dial.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_dial.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_dial.c Mon May 19 15:51:34 2008
@@ -789,8 +789,9 @@
 				strcpy(pa->status, "CANCEL");
 				ast_cdr_noanswer(in->cdr);
 				if (f) {
-					if (f->seqno)
-						in->hangupcause = f->seqno;
+					if (f->data_int) {
+						in->hangupcause = f->data_int;
+					}
 					ast_frfree(f);
 				}
 				return NULL;

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_disa.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_disa.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_disa.c Mon May 19 15:51:34 2008
@@ -195,8 +195,8 @@
 		}
 
 		if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
-			if (f->seqno)
-				chan->hangupcause = f->seqno;
+			if (f->data_int)
+				chan->hangupcause = f->data_int;
 			ast_frfree(f);
 			ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
 			return -1;

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_externalivr.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_externalivr.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_externalivr.c Mon May 19 15:51:34 2008
@@ -566,8 +566,8 @@
  			} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
  				ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
  				send_eivr_event(eivr_events, 'H', NULL, chan);
-				if (f->seqno) {
-					chan->hangupcause = f->seqno;
+				if (f->data_int) {
+					chan->hangupcause = f->data_int;
 				}
  				ast_frfree(f);
  				res = -1;

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_followme.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_followme.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_followme.c Mon May 19 15:51:34 2008
@@ -607,8 +607,8 @@
 					switch(f->subclass) {
 					case AST_CONTROL_HANGUP:
 						ast_verb(3, "%s received a hangup frame.\n", winner->name);
-						if (f->seqno) {
-							winner->hangupcause = f->seqno;
+						if (f->data_int) {
+							winner->hangupcause = f->data_int;
 						}
 						if (dg == 0) {
 							ast_verb(3, "The calling channel hungup. Need to drop everyone else.\n");

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_milliwatt.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_milliwatt.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_milliwatt.c Mon May 19 15:51:34 2008
@@ -61,9 +61,9 @@
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_ULAW,
 		.offset = AST_FRIENDLY_OFFSET,
-		.data = buf + AST_FRIENDLY_OFFSET,
 		.src = __FUNCTION__,
 	};
+	wf.data = buf + AST_FRIENDLY_OFFSET;
 
 	/* Instead of len, use samples, because channel.c generator_force
 	* generate(chan, tmp, 0, 160) ignores len. In any case, len is

Modified: team/mvanbaak/ast_frame_dataunion/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/apps/app_queue.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/apps/app_queue.c (original)
+++ team/mvanbaak/ast_frame_dataunion/apps/app_queue.c Mon May 19 15:51:34 2008
@@ -2648,8 +2648,9 @@
 				/* Got hung up */
 				*to = -1;
 				if (f) {
-					if (f->seqno)
-						in->hangupcause = f->seqno;
+					if (f->data_int) {
+						in->hangupcause = f->data_int;
+					}
 					ast_frfree(f);
 				}
 				return NULL;

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_alsa.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_alsa.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_alsa.c Mon May 19 15:51:34 2008
@@ -765,7 +765,7 @@
 		hookstate = 0;
 		grab_owner();
 		if (alsa.owner) {
-			ast_queue_hangup(alsa.owner, AST_CAUSE_NORMAL_CLEARING);
+			ast_queue_hangup_with_cause(alsa.owner, AST_CAUSE_NORMAL_CLEARING);
 			ast_channel_unlock(alsa.owner);
 		}
 	}

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_console.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_console.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_console.c Mon May 19 15:51:34 2008
@@ -874,7 +874,7 @@
 
 	pvt->hookstate = 0;
 	if (pvt->owner)
-		ast_queue_hangup(pvt->owner, -1);
+		ast_queue_hangup(pvt->owner);
 
 	unref_pvt(pvt);
 

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_gtalk.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_gtalk.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_gtalk.c Mon May 19 15:51:34 2008
@@ -620,7 +620,7 @@
 			ast_getformatname_multiple(s2, BUFSIZ, tmp->peercapability),
 			ast_getformatname_multiple(s3, BUFSIZ, tmp->jointcapability));
 		/* close session if capabilities don't match */
-		ast_queue_hangup(tmp->owner, -1);
+		ast_queue_hangup(tmp->owner);
 
 		return -1;
 
@@ -749,7 +749,7 @@
 	if (tmp) {
 		tmp->alreadygone = 1;
 		if (tmp->owner)
-			ast_queue_hangup(tmp->owner, -1);
+			ast_queue_hangup(tmp->owner);
 	} else
 		ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
 	gtalk_response(client, from, pak, NULL, NULL);

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_h323.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_h323.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_h323.c Mon May 19 15:51:34 2008
@@ -342,7 +342,7 @@
 			ast_debug(1, "Process pending hangup for %s\n", c->name);
 		c->_softhangup |= AST_SOFTHANGUP_DEV;
 		c->hangupcause = pvt->hangupcause;
-		ast_queue_hangup(c, pvt->hangupcause);
+		ast_queue_hangup_with_cause(c, pvt->hangupcause);
 		pvt->needhangup = 0;
 		pvt->newstate = pvt->newcontrol = pvt->newdigit = pvt->DTMFsched = -1;
 	}
@@ -2379,7 +2379,7 @@
 	/* Send hangup */
 	if (pvt->owner) {
 		pvt->owner->_softhangup |= AST_SOFTHANGUP_DEV;
-		ast_queue_hangup(pvt->owner, -1);
+		ast_queue_hangup(pvt->owner);
 		ast_channel_unlock(pvt->owner);
 	}
 	ast_mutex_unlock(&pvt->lock);
@@ -2404,7 +2404,7 @@
 	if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
 		pvt->owner->_softhangup |= AST_SOFTHANGUP_DEV;
 		pvt->owner->hangupcause = pvt->hangupcause = cause;
-		ast_queue_hangup(pvt->owner, cause);
+		ast_queue_hangup_with_cause(pvt->owner, cause);
 		ast_channel_unlock(pvt->owner);
 	}
 	else {

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_iax2.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_iax2.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_iax2.c Mon May 19 15:51:34 2008
@@ -1783,7 +1783,7 @@
 				usleep(1);
 				ast_mutex_lock(&iaxsl[callno]);
 			} else {
-				ast_queue_hangup(iaxs[callno]->owner, -1);
+				ast_queue_hangup(iaxs[callno]->owner);
 				ast_channel_unlock(iaxs[callno]->owner);
 				break;
 			}
@@ -2244,7 +2244,7 @@
 			/* If there's an owner, prod it to give up */
 			/* It is ok to use ast_queue_hangup() here instead of iax2_queue_hangup()
 			 * because we already hold the owner channel lock. */
-			ast_queue_hangup(owner, -1);
+			ast_queue_hangup(owner);
 		}
 
 		if (pvt->peercallno) {
@@ -2312,7 +2312,10 @@
 							ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %d, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass, f->ts, f->oseqno);
 						iaxs[callno]->error = ETIMEDOUT;
 						if (iaxs[callno]->owner) {
-							struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, .seqno = AST_CAUSE_DESTINATION_OUT_OF_ORDER };
+							struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
+							// because data/data_int is an anonymous member, we cannot set it at declaration
+							// that's why we initialize it after declaring fr
+							fr.data_int = AST_CAUSE_DESTINATION_OUT_OF_ORDER;
 							/* Hangup the fd */
 							iax2_queue_frame(callno, &fr); /* XXX */
 							/* Remember, owner could disappear */

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_jingle.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_jingle.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_jingle.c Mon May 19 15:51:34 2008
@@ -573,7 +573,7 @@
 	if (tmp) {
 		tmp->alreadygone = 1;
 		if (tmp->owner)
-			ast_queue_hangup(tmp->owner, -1);
+			ast_queue_hangup(tmp->owner);
 	} else
 		ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
 	jingle_response(client, pak, NULL, NULL);

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_local.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_local.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_local.c Mon May 19 15:51:34 2008
@@ -537,9 +537,12 @@
 {
 	struct local_pvt *p = ast->tech_pvt;
 	int isoutbound;
-	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, .seqno = ast->hangupcause };
+	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
 	struct ast_channel *ochan = NULL;
 	int glaredetect = 0, res = 0;
+	// because data/data_int is an anonymous member, we cannot set it at declaration
+	// that's why we initialize it after declaring f
+	f.data_int = ast->hangupcause;
 
 	if (!p)
 		return -1;

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_mgcp.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_mgcp.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_mgcp.c Mon May 19 15:51:34 2008
@@ -610,7 +610,7 @@
 	for(;;) {
 		if (sub->owner) {
 			if (!ast_channel_trylock(sub->owner)) {
-				ast_queue_hangup(sub->owner, -1);
+				ast_queue_hangup(sub->owner);
 				ast_channel_unlock(sub->owner);
 				break;
 			} else {

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_misdn.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_misdn.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_misdn.c Mon May 19 15:51:34 2008
@@ -2320,13 +2320,13 @@
 	
 	if (!p) {
 		ast_log(LOG_WARNING, " --> Channel not connected ??\n");
-		ast_queue_hangup(ast, AST_CAUSE_NETWORK_OUT_OF_ORDER);
+		ast_queue_hangup_with_cause(ast, AST_CAUSE_NETWORK_OUT_OF_ORDER);
 	}
 
 	if (!p->bc) {
 		chan_misdn_log(1, 0, " --> Got Answer, but theres no bc obj ??\n");
 
-		ast_queue_hangup(ast, AST_CAUSE_PROTOCOL_ERROR);
+		ast_queue_hangup_with_cause(ast, AST_CAUSE_PROTOCOL_ERROR);
 	}
 
 	tmp = pbx_builtin_getvar_helper(p->ast, "CRYPT_KEY");
@@ -3665,7 +3665,7 @@
 		send_cause2ast(ch->ast, ch->bc, ch);
 
 		if (ch->ast)
-			ast_queue_hangup(ch->ast, ch->bc->cause);
+			ast_queue_hangup_with_cause(ch->ast, ch->bc->cause);
 		cb_log(2, port, " --> queue_hangup\n");
 	} else {
 		cb_log(1, port, "Cannot hangup chan, no ast\n");

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_oss.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_oss.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_oss.c Mon May 19 15:51:34 2008
@@ -1040,7 +1040,7 @@
 	}
 	o->hookstate = 0;
 	if (o->owner)
-		ast_queue_hangup(o->owner, AST_CAUSE_NORMAL_CLEARING);
+		ast_queue_hangup_with_cause(o->owner, AST_CAUSE_NORMAL_CLEARING);
 	setformat(o, O_CLOSE);
 	return CLI_SUCCESS;
 }

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_sip.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_sip.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_sip.c Mon May 19 15:51:34 2008
@@ -2979,7 +2979,7 @@
 		if (pkt->owner->owner) {
 			sip_alreadygone(pkt->owner);
 			ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet.\n", pkt->owner->callid);
-			ast_queue_hangup(pkt->owner->owner, AST_CAUSE_PROTOCOL_ERROR);
+			ast_queue_hangup_with_cause(pkt->owner->owner, AST_CAUSE_PROTOCOL_ERROR);
 			ast_channel_unlock(pkt->owner->owner);
 		} else {
 			/* If no channel owner, destroy now */
@@ -3121,7 +3121,7 @@
 
 	if (p->owner) {
 		ast_log(LOG_WARNING, "Autodestruct on dialog '%s' with owner in place (Method: %s)\n", p->callid, sip_methods[p->method].text);
-		ast_queue_hangup(p->owner, AST_CAUSE_PROTOCOL_ERROR);
+		ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR);
 	} else if (p->refer) {
 		ast_debug(3, "Finally hanging up channel after transfer: %s\n", p->callid);
 		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
@@ -15828,7 +15828,7 @@
 		*/
 		xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
 		if (p->owner && !req->ignore) {
-			ast_queue_hangup(p->owner, AST_CAUSE_NORMAL_CLEARING);
+			ast_queue_hangup_with_cause(p->owner, AST_CAUSE_NORMAL_CLEARING);
 			append_history(p, "Hangup", "Got 487 on CANCEL request from us. Queued AST hangup request");
  		} else if (!req->ignore) {
 			update_call_counter(p, DEC_CALL_LIMIT);
@@ -15909,7 +15909,7 @@
 		if (p->owner) {
 			if (!p->refer) {
 				ast_log(LOG_WARNING, "Notify answer on an owned channel? - %s\n", p->owner->name);
-				ast_queue_hangup(p->owner, AST_CAUSE_NORMAL_UNSPECIFIED);
+				ast_queue_hangup_with_cause(p->owner, AST_CAUSE_NORMAL_UNSPECIFIED);
 			} else {
 				ast_debug(4, "Got OK on REFER Notify message\n");
 			}
@@ -16469,7 +16469,7 @@
 				default:
 					/* Send hangup */	
 					if (owner && sipmethod != SIP_MESSAGE && sipmethod != SIP_INFO && sipmethod != SIP_BYE)
-						ast_queue_hangup(p->owner, AST_CAUSE_PROTOCOL_ERROR);
+						ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR);
 					break;
 				}
 				/* ACK on invite */
@@ -16523,7 +16523,7 @@
 						ast_debug(1, "Got 200 OK on NOTIFY for transfer\n");
 					} else
 						ast_log(LOG_WARNING, "Notify answer on an owned channel?\n");
-					/* ast_queue_hangup(p->owner, -1); Disabled */
+					/* ast_queue_hangup(p->owner); Disabled */
 				} else {
 					if (!p->subscribed && !p->refer)
 						p->needdestroy = 1;
@@ -18373,7 +18373,7 @@
 
 	stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
 	if (p->owner)
-		ast_queue_hangup(p->owner, -1);
+		ast_queue_hangup(p->owner);
 	else
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 	if (p->initreq.len > 0) {
@@ -18532,15 +18532,15 @@
 					ast_queue_control(c, AST_CONTROL_UNHOLD);
 					ast_async_goto(bridged_to, p->context, p->refer->refer_to, 1);
 				} else
-					ast_queue_hangup(p->owner, -1);
+					ast_queue_hangup(p->owner);
 			}
 		} else {
 			ast_log(LOG_WARNING, "Invalid transfer information from '%s'\n", ast_inet_ntoa(p->recv.sin_addr));
 			if (p->owner)
-				ast_queue_hangup(p->owner, AST_CAUSE_PROTOCOL_ERROR);
+				ast_queue_hangup_with_cause(p->owner, AST_CAUSE_PROTOCOL_ERROR);
 		}
 	} else if (p->owner) {
-		ast_queue_hangup(p->owner, -1);
+		ast_queue_hangup(p->owner);
 		ast_debug(3, "Received bye, issuing owner hangup\n");
 	} else {
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_skinny.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_skinny.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_skinny.c Mon May 19 15:51:34 2008
@@ -4554,7 +4554,7 @@
 		if ((res = attempt_transfer(p)) < 0) {
 			if (sub->next && sub->next->owner) {
 				sub->next->alreadygone = 1;
-				ast_queue_hangup(sub->next->owner, -1);
+				ast_queue_hangup(sub->next->owner);
 			}
 		} else if (res) {
 			ast_log(LOG_WARNING, "Transfer attempt failed\n");
@@ -4566,7 +4566,7 @@
 		/* If there is another active call, skinny_hangup will ring the phone with the other call */
 		if (sub->owner) {
 			sub->alreadygone = 1;
-			ast_queue_hangup(sub->owner, -1);
+			ast_queue_hangup(sub->owner);
 		} else {
 			ast_log(LOG_WARNING, "Skinny(%s@%s-%d) channel already destroyed\n",
 				l->name, d->name, sub->callid);
@@ -5263,7 +5263,7 @@
 				if ((res = attempt_transfer(p)) < 0) {
 					if (sub->next && sub->next->owner) {
 						sub->next->alreadygone = 1;
-						ast_queue_hangup(sub->next->owner, -1);
+						ast_queue_hangup(sub->next->owner);
 					}
 				} else if (res) {
 					ast_log(LOG_WARNING, "Transfer attempt failed\n");
@@ -5275,7 +5275,7 @@
 				/* If there is another active call, skinny_hangup will ring the phone with the other call */
 				if (sub->owner) {
 					sub->alreadygone = 1;
-					ast_queue_hangup(sub->owner, -1);
+					ast_queue_hangup(sub->owner);
 				} else {
 					ast_log(LOG_WARNING, "Skinny(%s@%s-%d) channel already destroyed\n",
 						l->name, d->name, sub->callid);

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_unistim.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_unistim.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_unistim.c Mon May 19 15:51:34 2008
@@ -1125,7 +1125,7 @@
 				if (sub->owner) {       /* Call in progress ? */
 					if (unistimdebug)
 						ast_verb(0, "Aborting call\n");
-					ast_queue_hangup(sub->owner, AST_CAUSE_NETWORK_OUT_OF_ORDER);
+					ast_queue_hangup_with_cause(sub->owner, AST_CAUSE_NETWORK_OUT_OF_ORDER);
 				}
 			} else
 				ast_log(LOG_WARNING, "Freeing a client with no subchannel !\n");
@@ -1974,11 +1974,11 @@
 			if (attempt_transfer(sub, l->subs[SUB_THREEWAY]) < 0)
 				ast_verb(0, "attempt_transfer failed.\n");
 		} else
-			ast_queue_hangup(sub->owner, -1);
+			ast_queue_hangup(sub->owner);
 	} else {
 		if (l->subs[SUB_THREEWAY]) {
 			if (l->subs[SUB_THREEWAY]->owner)
-				ast_queue_hangup(l->subs[SUB_THREEWAY]->owner, AST_CAUSE_NORMAL_CLEARING);
+				ast_queue_hangup_with_cause(l->subs[SUB_THREEWAY]->owner, AST_CAUSE_NORMAL_CLEARING);
 			else
 				ast_log(LOG_WARNING, "threeway sub without owner\n");
 		} else
@@ -2312,7 +2312,7 @@
 		if (unistimdebug)
 			ast_verb(0, "Transfer canceled, hangup our threeway channel\n");
 		if (p->subs[SUB_THREEWAY]->owner)
-			ast_queue_hangup(p->subs[SUB_THREEWAY]->owner, AST_CAUSE_NORMAL_CLEARING);
+			ast_queue_hangup_with_cause(p->subs[SUB_THREEWAY]->owner, AST_CAUSE_NORMAL_CLEARING);
 		else
 			ast_log(LOG_WARNING, "Canceling a threeway channel without owner\n");
 		return;
@@ -2368,7 +2368,7 @@
 			/* start switch */
 			if (ast_pthread_create(&t, NULL, unistim_ss, c)) {
 				display_last_error("Unable to create switch thread");
-				ast_queue_hangup(c, AST_CAUSE_SWITCH_CONGESTION);
+				ast_queue_hangup_with_cause(c, AST_CAUSE_SWITCH_CONGESTION);
 			}
 		} else
 			ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n",

Modified: team/mvanbaak/ast_frame_dataunion/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/channels/chan_zap.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/channels/chan_zap.c (original)
+++ team/mvanbaak/ast_frame_dataunion/channels/chan_zap.c Mon May 19 15:51:34 2008
@@ -4523,7 +4523,7 @@
 							/* It hasn't been long enough since the last flashook.  This is probably a bounce on 
 							   hanging up.  Hangup both channels now */
 							if (p->subs[SUB_THREEWAY].owner)
-								ast_queue_hangup(p->subs[SUB_THREEWAY].owner, AST_CAUSE_NO_ANSWER);
+								ast_queue_hangup_with_cause(p->subs[SUB_THREEWAY].owner, AST_CAUSE_NO_ANSWER);
 							p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
 							ast_debug(1, "Looks like a bounced flash, hanging up both calls on %d\n", p->channel);
 							ast_channel_unlock(p->subs[SUB_THREEWAY].owner);
@@ -10121,7 +10121,7 @@
 				ast_mutex_lock(&p->lock);
 			}
 			if (p->subs[x].owner) {
-				ast_queue_hangup(p->subs[x].owner, AST_CAUSE_PRE_EMPTED);
+				ast_queue_hangup_with_cause(p->subs[x].owner, AST_CAUSE_PRE_EMPTED);
 				ast_channel_unlock(p->subs[x].owner);
 			}
 		}

Modified: team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c (original)
+++ team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c Mon May 19 15:51:34 2008
@@ -140,8 +140,8 @@
 		.datalen = sizeof(g722_slin_ex),
 		.samples = sizeof(g722_slin_ex) * 2,
 		.src = __PRETTY_FUNCTION__,
-		.data = g722_slin_ex,
 	};
+	f.data = g722_slin_ex;
 
 	return &f;
 }
@@ -154,8 +154,8 @@
 		.datalen = sizeof(g722_slin_ex),
 		.samples = sizeof(g722_slin_ex) * 2,
 		.src = __PRETTY_FUNCTION__,
-		.data = g722_slin_ex,
 	};
+	f.data = g722_slin_ex;
 
 	return &f;
 }
@@ -168,8 +168,8 @@
 		.datalen = sizeof(slin_g722_ex),
 		.samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]),
 		.src = __PRETTY_FUNCTION__,
-		.data = slin_g722_ex,
 	};
+	f.data = slin_g722_ex;
 
 	return &f;
 }
@@ -182,8 +182,8 @@
 		.datalen = sizeof(slin_g722_ex),
 		.samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]),
 		.src = __PRETTY_FUNCTION__,
-		.data = slin_g722_ex,
 	};
+	f.data = slin_g722_ex;
 
 	return &f;
 }

Modified: team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c (original)
+++ team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c Mon May 19 15:51:34 2008
@@ -794,8 +794,8 @@
 		.datalen = sizeof(g726_slin_ex),
 		.samples = sizeof(g726_slin_ex) * 2,	/* 2 samples per byte */
 		.src = __PRETTY_FUNCTION__,
-		.data = g726_slin_ex,
 	};
+	f.data = g726_slin_ex;
 
 	return &f;
 }
@@ -808,8 +808,8 @@
 		.datalen = sizeof(slin_g726_ex),
 		.samples = sizeof(slin_g726_ex) / 2,	/* 1 sample per 2 bytes */
 		.src = __PRETTY_FUNCTION__,
-		.data = slin_g726_ex,
 	};
+	f.data = slin_g726_ex;
 
 	return &f;
 }

Modified: team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c (original)
+++ team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c Mon May 19 15:51:34 2008
@@ -168,8 +168,8 @@
 		.datalen = sizeof(slin16_slin8_ex),
 		.samples = sizeof(slin16_slin8_ex) / sizeof(slin16_slin8_ex[0]),
 		.src = __PRETTY_FUNCTION__,
-		.data = slin16_slin8_ex,
 	};
+	f.data = slin16_slin8_ex;
 
 	return &f;
 }
@@ -182,8 +182,8 @@
 		.datalen = sizeof(slin8_slin16_ex),
 		.samples = sizeof(slin8_slin16_ex) / sizeof(slin8_slin16_ex[0]),
 		.src = __PRETTY_FUNCTION__,
-		.data = slin8_slin16_ex,
 	};
+	f.data = slin8_slin16_ex;
 
 	return &f;
 }

Modified: team/mvanbaak/ast_frame_dataunion/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/include/asterisk/channel.h?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/include/asterisk/channel.h (original)
+++ team/mvanbaak/ast_frame_dataunion/include/asterisk/channel.h Mon May 19 15:51:34 2008
@@ -731,7 +731,16 @@
  *
  * \note The channel does not need to be locked before calling this function.
  */
-int ast_queue_hangup(struct ast_channel *chan, int cause);
+int ast_queue_hangup(struct ast_channel *chan);
+
+/*! 
+ * \brief Queue a hangup frame with hangupcause set
+ *
+ * \note The channel does not need to be locked before calling this function.
+ * \param chan channel to queue frame onto
+ * \param cause the hangup cause
+ */
+int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause);
 
 /*!
  * \brief Queue a control frame with payload

Modified: team/mvanbaak/ast_frame_dataunion/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/include/asterisk/frame.h?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/include/asterisk/frame.h (original)
+++ team/mvanbaak/ast_frame_dataunion/include/asterisk/frame.h Mon May 19 15:51:34 2008
@@ -156,7 +156,7 @@
 	/*! Optional source of frame for debugging */
 	const char *src;				
 	/*! Pointer to actual data */
-	void *data;		
+	union { void *ptr; uint32_t uint32; char pad[8]; } data;
 	/*! Global delivery time */		
 	struct timeval delivery;
 	/*! For placing in a linked list */

Modified: team/mvanbaak/ast_frame_dataunion/main/app.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/main/app.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/main/app.c (original)
+++ team/mvanbaak/ast_frame_dataunion/main/app.c Mon May 19 15:51:34 2008
@@ -337,10 +337,10 @@
 	struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
-		.data = buf + AST_FRIENDLY_OFFSET / 2,
 		.offset = AST_FRIENDLY_OFFSET,
 	};
 	int res;
+	f.data = buf + AST_FRIENDLY_OFFSET / 2;
 
 	len = samples * 2;
 	if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {

Modified: team/mvanbaak/ast_frame_dataunion/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/main/audiohook.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/main/audiohook.c (original)
+++ team/mvanbaak/ast_frame_dataunion/main/audiohook.c Mon May 19 15:51:34 2008
@@ -158,10 +158,10 @@
 	struct ast_frame frame = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
-		.data = buf,
 		.datalen = sizeof(buf),
 		.samples = samples,
 	};
+	frame.data = buf;
 
 	/* Ensure the factory is able to give us the samples we want */
 	if (samples > ast_slinfactory_available(factory))
@@ -185,10 +185,10 @@
 	struct ast_frame frame = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
-		.data = NULL,
 		.datalen = sizeof(buf1),
 		.samples = samples,
 	};
+	frame.data = NULL;
 
 	/* Make sure both factories have the required samples */
 	usable_read = (ast_slinfactory_available(&audiohook->read_factory) >= samples ? 1 : 0);

Modified: team/mvanbaak/ast_frame_dataunion/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/main/channel.c?view=diff&rev=117213&r1=117212&r2=117213
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/main/channel.c (original)
+++ team/mvanbaak/ast_frame_dataunion/main/channel.c Mon May 19 15:51:34 2008
@@ -1007,18 +1007,30 @@
 }
 
 /*! \brief Queue a hangup frame for channel */
-int ast_queue_hangup(struct ast_channel *chan, int cause)
+int ast_queue_hangup(struct ast_channel *chan)
 {
 	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
+	/* Yeah, let's not change a lock-critical value without locking */
+	if (!ast_channel_trylock(chan)) {
+		chan->_softhangup |= AST_SOFTHANGUP_DEV;
+		ast_channel_unlock(chan);
+	}
+	return ast_queue_frame(chan, &f);
+}
+
+/*! \brief Queue a hangup frame for channel */
+int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
+{
+	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
 
 	if (cause >= 0)
-		f.seqno = cause;
+		f.data.uint32 = cause;
 
 	/* Yeah, let's not change a lock-critical value without locking */
 	if (!ast_channel_trylock(chan)) {
 		chan->_softhangup |= AST_SOFTHANGUP_DEV;
 		if (cause < 0)
-			f.seqno = chan->hangupcause;
+			f.data_int = chan->hangupcause;
 
 		ast_channel_unlock(chan);
 	}
@@ -2428,7 +2440,7 @@
 		/* Interpret hangup and return NULL */
 		/* XXX why not the same for frames from the channel ? */
 		if (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP) {
-			cause = f->seqno;
+			cause = f->data_int;
 			ast_frfree(f);
 			f = NULL;
 		}
@@ -4872,10 +4884,10 @@
 	struct ast_frame frame = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
-		.data = buf,
 		.samples = samples,
 		.datalen = sizeof(buf),
 	};
+	frame.data = buf;
 
 	memset(buf, 0, sizeof(buf));
 




More information about the asterisk-commits mailing list