[Asterisk-cvs] asterisk/channels chan_agent.c, 1.127, 1.128 chan_iax2.c, 1.259, 1.260 chan_local.c, 1.44, 1.45 chan_mgcp.c, 1.109, 1.110 chan_phone.c, 1.45, 1.46 chan_sip.c, 1.697, 1.698 chan_zap.c, 1.421, 1.422

markster at lists.digium.com markster at lists.digium.com
Mon Mar 28 14:54:37 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv4791/channels

Modified Files:
	chan_agent.c chan_iax2.c chan_local.c chan_mgcp.c chan_phone.c 
	chan_sip.c chan_zap.c 
Log Message:
Fix a bunch of const stuff, merge queue changes, add experimental "hybrid" DTMF mode


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- chan_agent.c	27 Mar 2005 02:09:06 -0000	1.127
+++ chan_agent.c	28 Mar 2005 20:48:24 -0000	1.128
@@ -201,7 +201,7 @@
 static int agent_answer(struct ast_channel *ast);
 static struct ast_frame *agent_read(struct ast_channel *ast);
 static int agent_write(struct ast_channel *ast, struct ast_frame *f);
-static int agent_sendhtml(struct ast_channel *ast, int subclass, char *data, int datalen);
+static int agent_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
 static int agent_indicate(struct ast_channel *ast, int condition);
 static int agent_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static struct ast_channel *agent_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
@@ -450,7 +450,7 @@
 	return f;
 }
 
-static int agent_sendhtml(struct ast_channel *ast, int subclass, char *data, int datalen)
+static int agent_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen)
 {
 	struct agent_pvt *p = ast->tech_pvt;
 	int res = -1;

Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -d -r1.259 -r1.260
--- chan_iax2.c	24 Mar 2005 05:02:49 -0000	1.259
+++ chan_iax2.c	28 Mar 2005 20:48:24 -0000	1.260
@@ -653,11 +653,11 @@
 static struct timeval lastused[IAX_MAX_CALLS];
 
 
-static int send_command(struct chan_iax2_pvt *, char, int, unsigned int, char *, int, int);
-static int send_command_locked(unsigned short callno, char, int, unsigned int, char *, int, int);
-static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, char *, int, int);
-static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, char *, int, int);
-static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, char *, int);
+static int send_command(struct chan_iax2_pvt *, char, int, unsigned int, const char *, int, int);
+static int send_command_locked(unsigned short callno, char, int, unsigned int, const char *, int, int);
+static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const char *, int, int);
+static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, const char *, int, int);
+static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const char *, int);
 static struct iax2_user *build_user(const char *name, struct ast_variable *v, int temponly);
 static void destroy_user(struct iax2_user *user);
 static int expire_registry(void *data);
@@ -670,9 +670,9 @@
 static struct ast_channel *iax2_request(const char *type, int format, void *data, int *cause);
 static int iax2_devicestate(void *data);
 static int iax2_digit(struct ast_channel *c, char digit);
-static int iax2_sendtext(struct ast_channel *c, char *text);
+static int iax2_sendtext(struct ast_channel *c, const char *text);
 static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img);
-static int iax2_sendhtml(struct ast_channel *c, int subclass, char *data, int datalen);
+static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen);
 static int iax2_call(struct ast_channel *c, char *dest, int timeout);
 static int iax2_hangup(struct ast_channel *c);
 static int iax2_answer(struct ast_channel *c);
@@ -681,7 +681,7 @@
 static int iax2_indicate(struct ast_channel *c, int condition);
 static int iax2_setoption(struct ast_channel *c, int option, void *data, int datalen);
 static int iax2_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
-static int iax2_transfer(struct ast_channel *c, char *dest);
+static int iax2_transfer(struct ast_channel *c, const char *dest);
 static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan);
 
 static const struct ast_channel_tech iax2_tech = {
@@ -2487,7 +2487,7 @@
 	return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_DTMF, digit, 0, NULL, 0, -1);
 }
 
-static int iax2_sendtext(struct ast_channel *c, char *text)
+static int iax2_sendtext(struct ast_channel *c, const char *text)
 {
 	
 	return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_TEXT,
@@ -2499,7 +2499,7 @@
 	return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_IMAGE, img->subclass, 0, img->data, img->datalen, -1);
 }
 
-static int iax2_sendhtml(struct ast_channel *c, int subclass, char *data, int datalen)
+static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen)
 {
 	return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_HTML, subclass, 0, data, datalen, -1);
 }
@@ -3214,7 +3214,7 @@
 	return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, NULL, 0, -1);
 }
 	
-static int iax2_transfer(struct ast_channel *c, char *dest)
+static int iax2_transfer(struct ast_channel *c, const char *dest)
 {
 	unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
 	struct iax_ie_data ied;
@@ -4484,7 +4484,7 @@
 	return res;
 }
 
-static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, char *data, int datalen, int seqno, 
+static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const char *data, int datalen, int seqno, 
 		int now, int transfer, int final)
 {
 	struct ast_frame f;
@@ -4495,16 +4495,16 @@
 	f.mallocd = 0;
 	f.offset = 0;
 	f.src = (char *)__FUNCTION__;
-	f.data = data;
+	f.data = (char *)data;
 	return iax2_send(i, &f, ts, seqno, now, transfer, final);
 }
 
-static int send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, char *data, int datalen, int seqno)
+static int send_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const char *data, int datalen, int seqno)
 {
 	return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0);
 }
 
-static int send_command_locked(unsigned short callno, char type, int command, unsigned int ts, char *data, int datalen, int seqno)
+static int send_command_locked(unsigned short callno, char type, int command, unsigned int ts, const char *data, int datalen, int seqno)
 {
 	int res;
 	ast_mutex_lock(&iaxsl[callno]);
@@ -4514,25 +4514,25 @@
 }
 
 #ifdef BRIDGE_OPTIMIZATION
-static int forward_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, char *data, int datalen, int seqno)
+static int forward_command(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const char *data, int datalen, int seqno)
 {
 	return __send_command(iaxs[i->bridgecallno], type, command, ts, data, datalen, seqno, 0, 0, 0);
 }
 #endif
 
-static int send_command_final(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, char *data, int datalen, int seqno)
+static int send_command_final(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const char *data, int datalen, int seqno)
 {
 	/* It is assumed that the callno has already been locked */
 	iax2_predestroy_nolock(i->callno);
 	return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1);
 }
 
-static int send_command_immediate(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, char *data, int datalen, int seqno)
+static int send_command_immediate(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const char *data, int datalen, int seqno)
 {
 	return __send_command(i, type, command, ts, data, datalen, seqno, 1, 0, 0);
 }
 
-static int send_command_transfer(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, char *data, int datalen)
+static int send_command_transfer(struct chan_iax2_pvt *i, char type, int command, unsigned int ts, const char *data, int datalen)
 {
 	return __send_command(i, type, command, ts, data, datalen, 0, 0, 1, 0);
 }

Index: chan_local.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_local.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- chan_local.c	16 Mar 2005 04:01:28 -0000	1.44
+++ chan_local.c	28 Mar 2005 20:48:24 -0000	1.45
@@ -61,7 +61,7 @@
 static int local_write(struct ast_channel *ast, struct ast_frame *f);
 static int local_indicate(struct ast_channel *ast, int condition);
 static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
-static int local_sendhtml(struct ast_channel *ast, int subclass, char *data, int datalen);
+static int local_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
 
 static const struct ast_channel_tech local_tech = {
 	.type = type,
@@ -264,7 +264,7 @@
 	return res;
 }
 
-static int local_sendhtml(struct ast_channel *ast, int subclass, char *data, int datalen)
+static int local_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen)
 {
 	struct local_pvt *p = ast->tech_pvt;
 	int res = -1;
@@ -273,7 +273,7 @@
 	ast_mutex_lock(&p->lock);
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.subclass = subclass;
-	f.data = data;
+	f.data = (char *)data;
 	f.datalen = datalen;
 	res = local_queue_frame(p, isoutbound, &f, ast);
 	ast_mutex_unlock(&p->lock);

Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- chan_mgcp.c	17 Mar 2005 21:30:19 -0000	1.109
+++ chan_mgcp.c	28 Mar 2005 20:48:24 -0000	1.110
@@ -120,6 +120,7 @@
 
 #define MGCP_DTMF_RFC2833	(1 << 0)
 #define MGCP_DTMF_INBAND	(1 << 1)
+#define MGCP_DTMF_HYBRID	(1 << 2)
 
 #define DEFAULT_MGCP_GW_PORT	2427 /* From RFC 2705 */
 #define DEFAULT_MGCP_CA_PORT	2727 /* From RFC 2705 */
@@ -988,6 +989,8 @@
 	if ((p->dtmfmode & MGCP_DTMF_INBAND) && p->dsp) {
 		/* SC: check whether other channel is active. */
 		if (!sub->next->owner) {
+			if (p->dtmfmode & MGCP_DTMF_HYBRID)
+				p->dtmfmode &= ~MGCP_DTMF_INBAND;
 			if (mgcpdebug) {
 				ast_verbose(VERBOSE_PREFIX_2 "MGCP free dsp on %s@%s\n", p->name, p->parent->name);
 			}
@@ -1377,7 +1380,7 @@
 		if (sub->rtp)
 			tmp->fds[0] = ast_rtp_fd(sub->rtp);
 		tmp->type = type;
-		if (i->dtmfmode & MGCP_DTMF_INBAND) {
+		if (i->dtmfmode & (MGCP_DTMF_INBAND | MGCP_DTMF_HYBRID)) {
 			i->dsp = ast_dsp_new();
 			ast_dsp_set_features(i->dsp,DSP_FEATURE_DTMF_DETECT);
 			/* SC: this is to prevent clipping of dtmf tones during dsp processing */
@@ -2617,6 +2620,10 @@
 					}
 					ast_setstate(chan, AST_STATE_RING);
 					/*zt_enable_ec(p);*/
+					if (p->dtmfmode & MGCP_DTMF_HYBRID) {
+						p->dtmfmode |= MGCP_DTMF_INBAND;
+						ast_indicate(chan, -1);
+					}
 					res = ast_pbx_run(chan);
 					if (res) {
 						ast_log(LOG_WARNING, "PBX exited non-zero\n");
@@ -3608,6 +3615,8 @@
 					dtmfmode = MGCP_DTMF_INBAND;
 				else if (!strcasecmp(v->value, "rfc2833")) 
 					dtmfmode = MGCP_DTMF_RFC2833;
+				else if (!strcasecmp(v->value, "hybrid"))
+					dtmfmode = MGCP_DTMF_HYBRID;
 				else if (!strcasecmp(v->value, "none")) 
 					dtmfmode = 0;
 				else
@@ -3702,6 +3711,8 @@
 					e->capability = capability;
 					e->parent = gw;
 					e->dtmfmode = dtmfmode;
+					if (!ep_reload && e->sub->rtp)
+						e->dtmfmode |= MGCP_DTMF_INBAND;
 					e->adsi = adsi;
 					e->type = TYPE_LINE;
 					e->immediate = immediate;

Index: chan_phone.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_phone.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- chan_phone.c	4 Mar 2005 06:47:24 -0000	1.45
+++ chan_phone.c	28 Mar 2005 20:48:24 -0000	1.46
@@ -139,7 +139,7 @@
 static struct ast_frame *phone_read(struct ast_channel *ast);
 static int phone_write(struct ast_channel *ast, struct ast_frame *frame);
 static struct ast_frame *phone_exception(struct ast_channel *ast);
-static int phone_send_text(struct ast_channel *ast, char *text);
+static int phone_send_text(struct ast_channel *ast, const char *text);
 
 static const struct ast_channel_tech phone_tech = {
 	.type = type,
@@ -536,7 +536,7 @@
 	return &p->fr;
 }
 
-static int phone_write_buf(struct phone_pvt *p, char *buf, int len, int frlen)
+static int phone_write_buf(struct phone_pvt *p, const char *buf, int len, int frlen)
 {
 	int res;
 	/* Store as much of the buffer as we can, then write fixed frames */
@@ -567,7 +567,7 @@
 	return len;
 }
 
-static int phone_send_text(struct ast_channel *ast, char *text)
+static int phone_send_text(struct ast_channel *ast, const char *text)
 {
     int length = strlen(text);
     return phone_write_buf(ast->tech_pvt, text, length, length) == 

Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.697
retrieving revision 1.698
diff -u -d -r1.697 -r1.698
--- chan_sip.c	28 Mar 2005 19:37:34 -0000	1.697
+++ chan_sip.c	28 Mar 2005 20:48:24 -0000	1.698
@@ -653,9 +653,9 @@
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sendsdp, char *auth, char *authheader, char *vxml_url, char *distinctive_ring, char *osptoken, int addsipheaders, int init);
 static int transmit_reinvite_with_sdp(struct sip_pvt *p);
 static int transmit_info_with_digit(struct sip_pvt *p, char digit);
-static int transmit_message_with_text(struct sip_pvt *p, char *text);
-static int transmit_refer(struct sip_pvt *p, char *dest);
-static int sip_sipredirect(struct sip_pvt *p, char *dest);
+static int transmit_message_with_text(struct sip_pvt *p, const char *text);
+static int transmit_refer(struct sip_pvt *p, const char *dest);
+static int sip_sipredirect(struct sip_pvt *p, const char *dest);
 static struct sip_peer *temp_peer(char *name);
 static int do_proxy_auth(struct sip_pvt *p, struct sip_request *req, char *header, char *respheader, int sipmethod, int init);
 static void free_old_route(struct sip_route *route);
@@ -670,17 +670,16 @@
 
 static struct ast_channel *sip_request(const char *type, int format, void *data, int *cause);
 static int sip_devicestate(void *data);
-static int sip_sendtext(struct ast_channel *ast, char *text);
+static int sip_sendtext(struct ast_channel *ast, const char *text);
 static int sip_call(struct ast_channel *ast, char *dest, int timeout);
 static int sip_hangup(struct ast_channel *ast);
 static int sip_answer(struct ast_channel *ast);
 static struct ast_frame *sip_read(struct ast_channel *ast);
 static int sip_write(struct ast_channel *ast, struct ast_frame *frame);
 static int sip_indicate(struct ast_channel *ast, int condition);
-static int sip_transfer(struct ast_channel *ast, char *dest);
+static int sip_transfer(struct ast_channel *ast, const char *dest);
 static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int sip_senddigit(struct ast_channel *ast, char digit);
-static int sip_sendtext(struct ast_channel *ast, char *text);
 static int clear_realm_authentication(struct sip_auth *authlist);                            /* Clear realm authentication list (at reload) */
 static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno);   /* Add realm authentication in list */
 static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, char *realm);         /* Find authentication for a specific realm */
@@ -1178,7 +1177,7 @@
 
 /*--- sip_sendtext: Send SIP MESSAGE text within a call ---*/
 /*      Called from PBX core text message functions */
-static int sip_sendtext(struct ast_channel *ast, char *text)
+static int sip_sendtext(struct ast_channel *ast, const char *text)
 {
 	struct sip_pvt *p = ast->tech_pvt;
 	int debug=sip_debug_test_pvt(p);
@@ -2098,7 +2097,7 @@
 
 
 /*--- sip_transfer: Transfer SIP call */
-static int sip_transfer(struct ast_channel *ast, char *dest)
+static int sip_transfer(struct ast_channel *ast, const char *dest)
 {
 	struct sip_pvt *p = ast->tech_pvt;
 	int res;
@@ -3122,7 +3121,7 @@
 }
 
 /*--- add_line: Add content (not header) to SIP message */
-static int add_line(struct sip_request *req, char *line)
+static int add_line(struct sip_request *req, const char *line)
 {
 	if (req->len >= sizeof(req->data) - 4) {
 		ast_log(LOG_WARNING, "Out of space, can't add anymore\n");
@@ -3573,7 +3572,7 @@
 }
 
 /*--- add_text: Add text body to SIP message ---*/
-static int add_text(struct sip_request *req, char *text)
+static int add_text(struct sip_request *req, const char *text)
 {
 	/* XXX Convert \n's to \r\n's XXX */
 	int len = strlen(text);
@@ -4603,7 +4602,7 @@
 }
 
 /*--- transmit_message_with_text: Transmit text with SIP MESSAGE method ---*/
-static int transmit_message_with_text(struct sip_pvt *p, char *text)
+static int transmit_message_with_text(struct sip_pvt *p, const char *text)
 {
 	struct sip_request req;
 	reqprep(&req, p, SIP_MESSAGE, 0, 1);
@@ -4612,7 +4611,7 @@
 }
 
 /*--- transmit_refer: Transmit SIP REFER message ---*/
-static int transmit_refer(struct sip_pvt *p, char *dest)
+static int transmit_refer(struct sip_pvt *p, const char *dest)
 {
 	struct sip_request req;
 	char from[256];
@@ -10633,7 +10632,7 @@
 /* Called by the transfer() dialplan application through the sip_transfer() */
 /* pbx interface function if the call is in ringing state */
 /* coded by Martin Pycko (m78pl at yahoo.com) */
-static int sip_sipredirect(struct sip_pvt *p, char *dest)
+static int sip_sipredirect(struct sip_pvt *p, const char *dest)
 {
 	char *cdest;
 	char *extension, *host, *port;

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.421
retrieving revision 1.422
diff -u -d -r1.421 -r1.422
--- chan_zap.c	27 Mar 2005 22:48:55 -0000	1.421
+++ chan_zap.c	28 Mar 2005 20:48:24 -0000	1.422
@@ -299,7 +299,7 @@
 
 static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
 
-static int zt_sendtext(struct ast_channel *c, char *text);
+static int zt_sendtext(struct ast_channel *c, const char *text);
 
 static inline int zt_get_event(int fd)
 {
@@ -615,7 +615,7 @@
 
 static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
 static int zt_digit(struct ast_channel *ast, char digit);
-static int zt_sendtext(struct ast_channel *c, char *text);
+static int zt_sendtext(struct ast_channel *c, const char *text);
 static int zt_call(struct ast_channel *ast, char *rdest, int timeout);
 static int zt_hangup(struct ast_channel *ast);
 static int zt_answer(struct ast_channel *ast);
@@ -10189,7 +10189,7 @@
 	return res;
 }
 
-static int zt_sendtext(struct ast_channel *c, char *text)
+static int zt_sendtext(struct ast_channel *c, const char *text)
 {
 #define	END_SILENCE_LEN 400
 #define	HEADER_MS 50




More information about the svn-commits mailing list