[Asterisk-cvs] asterisk/channels chan_vpb.c,1.49,1.50
bkramer at lists.digium.com
bkramer at lists.digium.com
Wed Dec 15 18:03:08 CST 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv32609
Modified Files:
chan_vpb.c
Log Message:
/ finished off support for DTMF caller ID (brazil) using patch provided by
/ Daniel Bichara
Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- chan_vpb.c 13 Dec 2004 21:04:12 -0000 1.49
+++ chan_vpb.c 15 Dec 2004 22:59:47 -0000 1.50
@@ -64,6 +64,10 @@
#define MAX_VPB_GAIN 12.0
+#define DTMF_CALLERID
+#define DTMF_CID_START 'D'
+#define DTMF_CID_STOP 'C'
+
/**/
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -237,7 +241,7 @@
char language[MAX_LANGUAGE]; /* language being used */
char callerid[AST_MAX_EXTENSION]; /* CallerId used for directly connected phone */
- int brcallerpos; /* Brazilian CallerID detection */
+ int dtmf_caller_pos; /* DTMF CallerID detection (Brazil)*/
int lastoutput; /* Holds the last Audio format output'ed */
int lastinput; /* Holds the last Audio format input'ed */
@@ -891,6 +895,7 @@
static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e)
{
char s[2] = {0};
+ struct ast_channel *owner = p->owner;
if (option_verbose > 3) {
char str[VPB_MAX_STR];
@@ -921,9 +926,9 @@
else {
ast_verbose(VERBOSE_PREFIX_4 "%s: handle_notowned: playing dialtone\n",p->dev);
playtone(p->handle, &Dialtone);
+ p->state=VPB_STATE_PLAYDIAL;
p->wantdtmf = 1;
p->ext[0] = 0; /* Just to be sure & paranoid.*/
- p->state=VPB_STATE_PLAYDIAL;
}
break;
@@ -961,6 +966,28 @@
case VPB_DTMF:
if (p->state == VPB_STATE_ONHOOK){
/* DTMF's being passed while on-hook maybe Caller ID */
+ if ( p->mode == MODE_FXO ) {
+ if ( e->data == DTMF_CID_START ) { /* CallerID Start signal */
+ p->dtmf_caller_pos = 0; /* Leaves the first digit out */
+ memset(p->callerid,0,AST_MAX_EXTENSION);
+ }
+ else if ( e->data == DTMF_CID_STOP ) { /* CallerID End signal */
+ p->callerid[p->dtmf_caller_pos] = '\0';
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 " %s: DTMF CallerID %s\n",p->dev,p->callerid);
+ if (owner->cid.cid_num)
+ free(owner->cid.cid_num);
+ owner->cid.cid_num=NULL;
+ if (owner->cid.cid_name)
+ free(owner->cid.cid_name);
+ owner->cid.cid_name=NULL;
+ owner->cid.cid_num = strdup(p->callerid);
+ } else if ( p->dtmf_caller_pos < AST_MAX_EXTENSION ) {
+ if ( p->dtmf_caller_pos >= 0 )
+ p->callerid[p->dtmf_caller_pos] = e->data;
+ p->dtmf_caller_pos++;
+ }
+ }
break;
}
if (p->wantdtmf == 1) {
More information about the svn-commits
mailing list