[Asterisk-Dev] Chan_VPB - Brazilian CallerID patch

Daniel Bichara daniel at bichara.com.br
Tue Aug 31 14:44:04 MST 2004



I talked to Welber and he is using version 1.0-RC1. There is some 
diferences to RC2 and probably that is the reason.

Daniel

Jorge Merlino wrote:

> Hi Daniel,
>
> That patch didn't work for me.  I'm in Uruguay but the ID is basically 
> the same only that here it starts with a D instead of an A.
> Your callerid detection works fine but Welber's code to copy the data 
> into the asterisk structure is in the wrong place. I could manage to 
> make it work inserting the code in the VPB_RING option of the notowned 
> handler.
> I'll clean up my debug code and send another patch soon.
>
> Regards,
>    Jorge
>
>
> Daniel Bichara wrote:
>
>> Hi all,
>>
>> Attached patched to implement Brazilian CallerID detection feature to 
>> chan_vpb.c
>>
>> Daniel
>>
>> ------------------------------------------------------------------------
>>
>> --- asterisk-1.0-RC2/channels/chan_vpb.c    2004-08-22 
>> 21:00:08.000000000 -0300
>> +++ asterisk.new/channels/chan_vpb.c    2004-08-29 11:36:18.000000000 
>> -0300
>> @@ -8,6 +8,11 @@
>>  * Copyright (C) 2004, Ben Kramer
>>  * Ben Kramer <ben at voicetronix.com.au>
>>  *
>> + * Daniel Bichara <daniel at bichara.com.br> - Brazilian CallerID 
>> detection (c)2004
>> + *
>> + * Welber Silveira - welberms at magiclink.com.br - (c)2004
>> + * Copying CLID string to propper structure after detection
>> + *
>>  * This program is free software, distributed under the terms of
>>  * the GNU General Public License
>>  */
>> @@ -237,6 +241,8 @@
>>
>>     struct vpb_pvt *next;            /* Next channel in list */
>>
>> +    int brcallerpos;                /* Brazilian CallerID detection */
>> +
>> } *iflist = NULL;
>>
>> static struct ast_channel *vpb_new(struct vpb_pvt *i, int state, char 
>> *context);
>> @@ -486,6 +492,10 @@
>>         ast_verbose(VERBOSE_PREFIX_4 "%s: handle_owned: got event: 
>> [%d=>%d]\n",
>>             p->dev, e->type, e->data);
>>
>> +    /* Welber Silveira - welberms at magiclink.com.br - (c)2004
>> +     * Copying CLID string to propper structure after detection */
>> +    p->owner->callerid = strdup(p->callerid);
>> +
>>     f.src = type;
>>     switch (e->type) {
>>         case VPB_RING:
>> @@ -749,6 +759,26 @@
>>         case VPB_DTMF:
>>             if (p->state == VPB_STATE_ONHOOK){
>>                 /* DTMF's being passed while on-hook maybe Caller ID */
>> +
>> +                /* Daniel Bichara - daniel at bichara.com.br - (c)2004
>> +                 * Brazilian CallerID detection */
>> +                if ( p->mode == MODE_FXO ) { /* FXO and DTMF - 
>> brazilian callerid */
>> +                    if ( e->data == 'A' ) { /* CallerID Start signal */
>> +                        p->brcallerpos = -1;
>> +                        memset(p->callerid,0,AST_MAX_EXTENSION);
>> +                    }
>> +                    else if ( e->data == 'C' ) { /* CallerID End 
>> signal */
>> +                        p->callerid[p->brcallerpos] = '\0';
>> +                        if (option_verbose > 2)
>> +                            ast_verbose(VERBOSE_PREFIX_3 " %s: 
>> CallerID %s\n",p->dev,p->callerid);
>> +
>> +                    } else if ( p->brcallerpos < AST_MAX_EXTENSION ) {
>> +                        if ( p->brcallerpos >= 0 )
>> +                            p->callerid[p->brcallerpos] = e->data;
>> +                        p->brcallerpos++;
>> +                    }
>> +                }
>> +
>>                 break;
>>             }
>>             if (p->wantdtmf == 1) {
>> @@ -895,11 +925,13 @@
>>             */
>>         }
>>         /* Two scenarios: Are you owned or not. */
>> +
>>         if (p->owner) {
>>             monitor_handle_owned(p, &e);
>>         } else {
>>             monitor_handle_notowned(p, &e);
>>         }
>> +
>>         /* if ((!p->owner)&&(p->golock)){
>>             ast_mutex_unlock(&p->owner->lock);
>>             ast_mutex_unlock(&p->lock);
>>  
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Asterisk-Dev mailing list
>> Asterisk-Dev at lists.digium.com
>> http://lists.digium.com/mailman/listinfo/asterisk-dev
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>>
>
>
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>




More information about the asterisk-dev mailing list