Post new topic Reply to topic  [ 2 posts ] 

Board index : TeleFlow Forums : General

Author Message
 Post subject:
PostPosted: Tue Jun 22, 2004 3:22 pm 
Offline

Joined: Tue Jun 22, 2004 3:17 pm
Posts: 1
Hi, <br> <br> I have writtena a code which makes calls using Intel Dialogic card. It has a T1 interface through which it makes calls. <br> <br> My code works fine. it dials and plays the wave file. the problem I have is my code doesnt wait for the operator Intercept (doesnt wait for the response from the other end, plays file when the other end goes off hook). <br> <br> researching the web I found that I should use ATDX_CPTERM() function to enable call analysis. but the problem is my code doesnt send a signal to ATDX_CPTERM(). I dont know where I am going wrong. please correct me. <br> <br>************************************** <br>/* Call Analysis with user-specified parameters and synchronous mode. */ <br> <br>#include <stdio.h> <br>#include <srllib.h> <br>#include <dxxxlib.h> <br>#include <windows.h> <br>#include <sctools.h> <br>#include <dtilib.h> <br>int AON_received = 0; <br>long int AON_handler(unsigned long evhandle); <br>long int CON_handler(unsigned long evhandle); <br>main(){ <br> int chdev, dti; <br> int parm = 3; <br> int mode = EV_SYNC; <br> char dialstrg[11] = "2059783440"; <br> int res; <br> DX_CAP capp; <br> DV_TPT tptplay; <br> int retval; <br> <br> /* Open voice channel */ <br> if ((chdev = dx_open("dxxxB1C4",NULL)) == -1) { <br> printf("Error in channel open\n"); <br> } <br> /* Open dti time slot */ <br> if((dti = dt_open("dtiB1T4",NULL)) == -1){ <br> printf("Error in dti board open\n"); <br> } <br> /* Map voice and dti boards */ <br> if(nr_scroute(chdev,SC_VOX,dti,SC_DTI,SC_FULLDUP)== -1 ){ <br> printf("Error in nr_scroute"); <br> return 0; <br> }else{ <br> printf("Mapped properly \n"); <br> } <br> /* Clear DX_CAPP structure */ <br> dx_clrcap(&capp); <br> capp.ca_nbrdna = 3; <br> capp.ca_dtn_pres = 100; <br> capp.ca_dtn_npres = 100; <br> capp.ca_noanswer = 2000; <br> capp.ca_intflg = 8; <br> /* set on hook */ <br> if((res = dt_settssigsim(dti, DTB_AOFF|DTB_BOFF))== -1){ <br> printf("Error in dt_setssigsim %s\n",ATDV_ERRMSGP(dti)); <br> } <br> Sleep(500); <br> /* set off hook */ <br> if((res = dt_settssigsim(dti, DTB_AON|DTB_BON))== -1){ <br> printf("Error in dt_setssigsim %s\n",ATDV_ERRMSGP(dti)); <br> } <br> if(dx_setevtmsk(chdev,DM_RINGS|DM_LCON|DM_SILOFF|DM_SILON|DM_WINK)== -1){ <br> printf("Error in dx_setevtmsk"); <br> } <br> Sleep(500); <br> if(dx_setsvmt(chdev, SV_VOLUMETBL,NULL, SV_SETDEFAULT) == -1){ <br> printf("Error in dx_setsvmt()\n"); <br> } <br> if (dx_dial(chdev,dialstrg,&capp,DX_CALLP|EV_ASYNC) == -1) { <br> printf("Error in dial\n"); <br> } <br> else{ <br> printf("No error in Dial function \n"); <br> } <br> if(sr_enbhdlr(chdev, TDX_CST,CON_handler)==-1){ <br> printf("Unable to set CON_hanlder for device %s \n",ATDV_NAMEP(chdev)); <br> } <br> <br> if((retval = sr_enbhdlr(dti, DTEV_SIG, AON_handler)) == -1){ <br> printf("unable to set AON hadnler for device %s \n",ATDV_NAMEP(dti)); <br> return (retval); <br> } <br> tptplay.tp_type = IO_EOT; <br> tptplay.tp_termno = DX_MAXDTMF; <br> tptplay.tp_length = 1; <br> tptplay.tp_flags = TF_MAXDTMF; <br> //Sleep(1500); <br> while( AON_received == 0) { <br> Sleep( 1 ); /* Sleep until we receive an incoming call */ <br> } <br> printf("BON_received %d\n",AON_received); <br> if(dx_playwav(chdev, "c:\\temp\\ezpay.wav", &tptplay,EV_SYNC) == -1){ <br> printf("Error playing file - %s \n", ATDV_ERRMSGP(chdev)); <br> exit(1); <br> } <br> <br> printf("Played audio file \n"); <br> /* set on hook */ <br> if((res = dt_settssigsim(dti, DTB_AOFF|DTB_BOFF))== -1){ <br> printf("Error in dt_setssigsim %s\n",ATDV_ERRMSGP(dti)); <br> } <br> /* unMap voice and dti boards */ <br> if(nr_scunroute(chdev,SC_VOX,dti,SC_DTI,SC_FULLDUP)== -1 ){ <br> printf("Error in nr_scroute"); <br> return 0; <br> } <br> dx_close(chdev); <br> dt_close(dti); <br> return 1; <br>} <br> <br>long int AON_handler(unsigned long evhandle){ <br> printf( "dx_handler() called, event is 0x%x\n", sr_getevttype(evhandle)); <br> long int event = sr_getevttype(evhandle); <br> int *datap = (int *)sr_getevtdatap(); <br> short indx; <br> if(event != DTEV_SIG){ <br> printf("Unknown event %d received. Data = %d \n",event,*datap); <br> return 0; <br> } <br> for(indx = 0; indx <4; indx++){ <br> if(!(*datap &(0x1010 <<indx))){ <br> continue; <br> } <br> switch (*datap &(0x1111<<indx)){ <br> case DTMM_AON: <br> AON_received = 2; <br> break; <br> case DTMM_BON: <br> AON_received = 1; <br> break; <br> case DTB_AOFF: <br> AON_received = 4; <br> break; <br> case DTB_BOFF: <br> AON_received = 5; <br> break; <br> default: <br> printf("Signal event error:data = %d\n",*datap); <br> } <br> if ((*datap & DTMM_BOFF) == DTMM_BOFF) { <br> AON_received = 6; <br> printf("Call disconnected DTMM_BOFF \n"); <br> exit(1); <br> } <br> } <br> return AON_received; <br>} <br> <br>long int CON_handler(unsigned long evhandle){ <br> DX_CST *cstp; <br> printf( "CON Handler called, \n"); <br> if (sr_getevttype(evhandle)==TDX_CALLP) { <br> switch (ATDX_CPTERM(sr_getevtdev(evhandle))){ <br> case CR_CNCT: <br> printf("Ring event occurred on channel \n"); <br> break; <br> case CR_CEPT: <br> printf("Operator Intercepted\n"); <br> break; <br> case CR_STOPD: <br> printf("stopped\n"); <br> break; <br> case CR_ERROR: <br> printf("Error in calling %s\n",ATDV_ERRMSGP(evhandle)); <br> break; <br> case AT_FAILURE: <br> printf("Error in failure \n"); <br> break; <br> case CR_NOANS: <br> printf("No answer\n"); <br> break; <br> default: <br> printf("This is default test\n"); <br> break; <br> } <br> } <br> return 1; <br>} <br>*************************************** <br>Thanks <br>Chandhru


Back to top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 9:26 am 
Offline

Joined: Wed Mar 19, 2003 4:28 pm
Posts: 510
Location: Canada
Sorry, but the enGenic DevNet forum is for TeleFlow and enGenic-product-related issues only.


Back to top
 Profile WWW 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Board index : TeleFlow Forums : General


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.