On Thu, 2007-05-03 at 16:47 +0500, Rizwan Hisham wrote:
> Hi all,
> i just updated to asterisk 1.4.4 from 1.4.2. i was doing this to
> forward an unanswered call in 1.4.2
> 
> exten=> 1,1,Dial(SIP/123,,Ttg)
> exten=> 1,2,Gotoif($[${DIALSTATUS}=ANSWERED]?:10)
> exten=> 1,3,Hangup 
> 
> exten=> 1,10,Dial(Local/2,,Ttg)
> exten=> 1,11,Hangup
> 
> exten=> 2,1,Dial(SIP/234,,Ttg)
> exten=> 2,2,Hangup
> 
> All the CDR variables for the first channel (SIP/123) are fine. but
> when local channel initiates, it does not copy the CDR(accountcode)
> variable from the first channel (in asterisk 1.4.4), whereas it did in
> 1.4.2. so the CDR(accountcode) variable for local channel is empty in
> 1.4.4. This is a big problem for me as i have to charge the forwarded
> calls also and all calls are charged based on account code. If
> accountcode is empty, i cant make a decision how to charge the call. 
> 
> Can anybody fix this for me or do i have to jump back to asterisk
> 1.4.2?
> 
> -- 
> Regards
> Rizwan Hisham
> Software Engineer 

Riswan--

This could easily be my fault. I've attached a fix, that I can commit to
the source, if it works for you.

Here the instructions:

1. save the attachment to a file.
2. cd to your 1.4-source/channels directory
3. patch -p0 < localfix
4. cd ..
5. make
6. make install

test

If there's no differences, you still have the same problem, you'd best
restore the source to it's previous condition:

1. cd 1.4-sourcedir/channels
2. mv chan_local.c.orig chan_local.c
3. cd ..
4. make
5. make install

This patch will properly set the accountcode amaflag from the local
channel's owner at channel creation time, and therefore, the local
channels' CDR as well.


-- 
Steve Murphy
Software Developer
Digium
Index: chan_local.c
===================================================================
--- chan_local.c	(revision 62984)
+++ chan_local.c	(working copy)
@@ -594,10 +594,22 @@
 {
 	struct ast_channel *tmp = NULL, *tmp2 = NULL;
 	int randnum = ast_random() & 0xffff, fmt = 0;
+	const char *t;
+	int ama;
 
 	/* Allocate two new Asterisk channels */
-	if (!(tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "Local/[EMAIL PROTECTED],1", p->exten, p->context, randnum)) 
-			|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, "", p->exten, p->context, 0, "Local/[EMAIL PROTECTED],2", p->exten, p->context, randnum))) {
+	/* safe accountcode */
+	if (p->owner && p->owner->accountcode)
+		t = p->owner->accountcode;
+	else
+		t = "";
+
+	if (p->owner)
+		ama = p->owner->amaflags;
+	else
+		ama = 0;
+	if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, ama, "Local/[EMAIL PROTECTED],1", p->exten, p->context, randnum)) 
+			|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, ama, "Local/[EMAIL PROTECTED],2", p->exten, p->context, randnum))) {
 		if (tmp)
 			ast_channel_free(tmp);
 		if (tmp2)

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to