Re: Record with bayonne 1.2.15 And AudioFeed Question

Tristan <[email protected]> Fri, 17 Feb 2006 12:58:40 +0100
Newsgroups gmane.comp.gnu.bayonne.devel
Message-ID <[email protected]>
Ok,
the analog handle ( SC_LSI ) is used by the d2, i get m2 filled with 
SC_LSI...

Should it be m1 since this is the analog interface that initiate the join ?


Julien Chavanton wrote:

>I do not know since I am using only digital trunk,
>I would look at tsinfo structure to verify that the analog handle is used and verify to be sure dx_ function is called.
> 
>Look at this part be sure it is selecting SC_LSI on the analog side.
> 
>     if(interface == NT_ANALOG)
>     {
>         if(!routing)
>             return false;
>
>         d1 = chdev;
>         m1 = SC_LSI;
>     }
>     else
>     {
>         d1 = tsdev;
>         m1 = SC_DTI;
>     }
> 
>     case SC_LSI:
>                 dx_getxmitslot(d1, &tsinfo1);
> 
> 
>*Globalcall drivers where migrated from Dialogic drivers and some part of analog support may still be broken.
>However the Digital ISDN support is really good.
> 
>Julien
> 
>             
>
>
>	-----Original Message----- 
>	From: Tristan [mailto:[email protected]] 
>	Sent: Thu 2/16/2006 06:50 AM 
>	To: Julien Chavanton 
>	Cc: [email protected] 
>	Subject: Re: [Bayonne-devel] Record with bayonne 1.2.15 And AudioFeed Question
>	
>	
>
>	Seems like this patch is working good BUT the only voice recorded comes
>	from the digital interface ( ie incoming call ), I can't get the analog
>	outgoing call to be recorded...
>	
>	Do you have an idea why ?
>	
>	
>	
>	Tristan
>	
>	
>	----------------------------------------------
>	
>	Sorry I forgot to add the modified patch:
>	
>	One more question, looking at
>	http://resource.intel.com/telecom/support/releases/unix51/linux51fp1/onldoc/htmlfiles/voxapi/1453-02-92.html#P12867_337275
>	I see that the flags to set for recording are not the same as in the
>	source code for dx_recm()
>	Is it ok or was it a mistake ? ( RM_SR8 instead of PM_SR8 )
>	
>	
>	
>	---------Patch------------------
>	
>	#include <sys/ioctl.h>
>	#include <linux/cdrom.h>
>	#define MAXLEN 10000
>	
>	
>	////////////////////////////////////////////
>	// Modification to DialogicTrunk::Join()  //
>	////////////////////////////////////////////
>	bool DialogicTrunk::Join(DialogicTrunk *trunk)
>	{
>	     int d1, d2, m1, m2;
>	     unsigned flags = MD_PCM | PM_SR8;
>	     SC_TSINFO tsinfo1, tsinfo2, rtsinfo;
>	     long scts1, scts2, arrayp[32];
>	
>	     if(interface == NT_ANALOG)
>	     {
>	         if(!routing)
>	             return false;
>	
>	         d1 = chdev;
>	         m1 = SC_LSI;
>	     }
>	     else
>	     {
>	         d1 = tsdev;
>	         m1 = SC_DTI;
>	     }
>	     if(trunk->interface == NT_ANALOG)
>	     {
>	         if(!trunk->routing)
>	             return false;
>	         d2 = trunk->chdev;
>	         m2 = SC_LSI;
>	     }
>	     else
>	     {
>	         d2 = trunk->tsdev;
>	         m2 = SC_DTI;
>	     }
>	     if(trunk->join)
>	         return false;
>	
>	     trunk->enterMutex();
>	     nr_scroute(d1, m1, d2, m2, SC_FULLDUP);
>	     join = trunk;
>	     join->join = this;
>	     trunk->leaveMutex();
>	     if(trunk->data.join.recfn)
>	     {
>	         switch(getEncoding())
>	         {
>	             case mulawAudio:
>	                 flags = MD_PCM | RM_SR8 | MD_GAIN;
>	                 break;
>	             case alawAudio:
>	                 flags = MD_PCM | PM_ALAW | PM_SR8;
>	                 break;
>	             case voxADPCM:
>	                 flags = MD_ADPCM | PM_SR6;
>	             default:
>	                 flags = MD_ADPCM | PM_SR6;
>	                 break;
>	         }
>	         tsinfo1.sc_numts = 1;
>	         tsinfo1.sc_tsarrayp = &scts1;
>	         switch(m1)
>	         {
>	             case SC_LSI:
>	                 dx_getxmitslot(d1, &tsinfo1);
>	                 break;
>	             case SC_DTI:
>	                 dt_getxmitslot(d1, &tsinfo1);
>	                 break;
>	         }
>	         tsinfo2.sc_numts = 1;
>	         tsinfo2.sc_tsarrayp = &scts2;
>	         switch(m2)
>	         {
>	             case SC_LSI:
>	                 dx_getxmitslot(d2, &tsinfo2);
>	                 break;
>	             case SC_DTI:
>	                 dt_getxmitslot(d2, &tsinfo2);
>	                 break;
>	         }
>	         arrayp[0] = scts1;
>	         arrayp[1] = scts2;
>	         rtsinfo.sc_numts = 2;
>	         rtsinfo.sc_tsarrayp = &arrayp[0];
>	
>	         trunk->iofile.io_length = -1;
>	
>	         DV_TPT tpt;
>	         DX_IOTT iott[2];
>	         char basebufp[MAXLEN];
>	         dx_clrtpt(&tpt,1);
>	         tpt.tp_type   = IO_EOT;
>	         tpt.tp_termno = DX_LCOFF;
>	         tpt.tp_length = 1;
>	
>	
>	         iott[1].io_type = IO_DEV | IO_EOT ;
>	         iott[1].io_bufp = 0;
>	         iott[1].io_offset = 0;
>	         iott[1].io_length = -1 ;
>	         iott[1].io_fhandle = ::open(trunk->data.join.recfn, O_RDWR |
>	O_CREAT  | O_TRUNC, 0666) ;
>	
>	         slog(Slog::levelCritical) <<" RECORDING JOINED TIME SLOT : "<<
>	trunk->data.join.recfn<<endl;
>	
>	         dx_clrdigbuf(chdev);
>	
>	//        slog(Slog::levelCritical) <<"dx_recm("<<chdev<<")"<<endl;
>	         if(dx_recm(chdev, &iott[1], &tpt, EV_ASYNC | flags , &rtsinfo)
>	== -1) {
>	             slog(Slog::levelCritical) << "dxrecm() error" << endl;
>	         }
>	         slog(Slog::levelCritical) <<"dx_recm("<<chdev<<")=SUCCESS"<<endl;
>	
>	
>	/*
>	         if(dx_recm(chdev, &trunk->iofile, dialogicivr.getPlayTPT(),
>	         EV_ASYNC | flags, &rtsinfo) < 0)
>	         slog(Slog::levelError) << "dxrecm() error" << endl;
>	*/
>	
>	     //  postError(chdev, "vox");
>	
>	     }
>	     return true;
>	}
>	
>	---------------------------------------------------------------
>	
>	
>	
>	Instead of std::open, we have to use ::open ;)
>	
>	But that creates a file that is not usable in vox format...
>	The thing is that the file is created and it is recording but there's no
>	header for .au files.
>	
>	When I don't set the extention ( join %trunkid record=myfile ) I see two
>	files created in /var/lib/bayonne
>	( myfile containing the raw audio and myfile.au which is header only... )
>	
>	Do you have an idea on what to do ?
>	
>	Julien Chavanton wrote:
>	
>	>True, this is not accepted with new compiler!
>	>
>	>I will check this if you give me some time.
>	>
>	>Julien
>	>
>	>-----Original Message-----
>	>From: Tristan [mailto:[email protected]]
>	>Sent: February 14, 2006 11:34 AM
>	>To: Julien Chavanton
>	>Subject: Re: [Bayonne-devel] Record with bayonne 1.2.15 And AudioFeed
>	>Question
>	>
>	>Hi,
>	>Just a question since it's been a long time I didn't code in C++ ,
>	>
>	>I already changed your patch :
>	>Added: #define MAXLEN 100000 // MAXLEN was undefined ...
>	>
>	>Changed:
>	>
>	>  if(interface == ANALOG) => if(interface == NT_ANALOG) // The exact
>	>name is NT_ANALOG
>	>
>	>    if(trunk->interface == ANALOG) => if(trunk->interface == NT_ANALOG)
>	>  
>	>But I don't remember where to find the standard c++ function open
>	>because I get this error:
>	>
>	>trunk.cpp: Dans member function < bool
>	>   ost::DialogicTrunk::Join(ost::DialogicTrunk*) >:
>	>trunk.cpp:387: error: `open' undeclared in namespace `std'
>	>
>	>
>	>Do you have an idea ?
>	>
>	>Julien Chavanton wrote:
>	>
>	> 
>	>
>	>>join %session.parent record=recording.vox
>	>>
>	>>I suggest you try with dialogic vox file format
>	>>
>	>>
>	>>////////////////////////////////////////////
>	>>// Modification to DialogicTrunk::Join()  //
>	>>////////////////////////////////////////////
>	>>bool DialogicTrunk::Join(DialogicTrunk *trunk)
>	>>{
>	>> int d1, d2, m1, m2;
>	>> unsigned flags = MD_PCM | PM_SR8;
>	>> SC_TSINFO tsinfo1, tsinfo2, rtsinfo;
>	>> long scts1, scts2, arrayp[32];
>	>>
>	>> if(interface == ANALOG)
>	>> {
>	>>   if(!routing)
>	>>     return false;
>	>>
>	>>   d1 = chdev;
>	>>   m1 = SC_LSI;
>	>> }
>	>> else
>	>> {
>	>>   d1 = tsdev;
>	>>   m1 = SC_DTI;
>	>> }
>	>> if(trunk->interface == ANALOG)
>	>> {
>	>>   if(!trunk->routing)
>	>>     return false;
>	>>   d2 = trunk->chdev;
>	>>   m2 = SC_LSI;
>	>> }
>	>> else
>	>> {
>	>>   d2 = trunk->tsdev;
>	>>   m2 = SC_DTI;
>	>> }
>	>> if(trunk->join)
>	>>   return false;
>	>>
>	>> trunk->enterMutex();
>	>>       nr_scroute(d1, m1, d2, m2, SC_FULLDUP);
>	>>       join = trunk;
>	>>       join->join = this;
>	>> trunk->leaveMutex();
>	>> if(trunk->data.join.recfn)
>	>> {
>	>>   switch(getEncoding())
>	>>   {
>	>>   case mulawAudio:
>	>>     flags = MD_PCM | PM_SR8;
>	>>     break;
>	>>   case alawAudio:
>	>>     flags = MD_PCM | PM_ALAW | PM_SR8;
>	>>     break;
>	>>   case voxADPCM:
>	>>     flags = MD_ADPCM | PM_SR6;
>	>>   default:
>	>>     flags = MD_ADPCM | PM_SR6;
>	>>     break;
>	>>   }
>	>>   tsinfo1.sc_numts = 1;
>	>>   tsinfo1.sc_tsarrayp = &scts1;
>	>>   switch(m1)
>	>>   {
>	>>   case SC_LSI:
>	>>     dx_getxmitslot(d1, &tsinfo1);
>	>>     break;
>	>>   case SC_DTI:
>	>>     dt_getxmitslot(d1, &tsinfo1);
>	>>     break;
>	>>   }
>	>>   tsinfo2.sc_numts = 1;
>	>>   tsinfo2.sc_tsarrayp = &scts2;
>	>>   switch(m2)
>	>>   {
>	>>   case SC_LSI:
>	>>     dx_getxmitslot(d2, &tsinfo2);
>	>>     break;
>	>>   case SC_DTI:
>	>>     dt_getxmitslot(d2, &tsinfo2);
>	>>     break;
>	>>   }
>	>>   arrayp[0] = scts1;
>	>>   arrayp[1] = scts2;
>	>>   rtsinfo.sc_numts = 2;
>	>>   rtsinfo.sc_tsarrayp = &arrayp[0];
>	>>
>	>>   trunk->iofile.io_length = -1;
>	>>
>	>>DV_TPT tpt;
>	>>DX_IOTT iott[2];
>	>>char basebufp[MAXLEN];
>	>>dx_clrtpt(&tpt,1);
>	>>tpt.tp_type   = IO_EOT;
>	>>tpt.tp_termno = DX_LCOFF;
>	>>tpt.tp_length = 1;
>	>>
>	>>
>	>>iott[1].io_type = IO_DEV | IO_EOT ;
>	>>iott[1].io_bufp = 0;
>	>>iott[1].io_offset = 0;
>	>>iott[1].io_length = -1 ;
>	>>iott[1].io_fhandle = std::open(trunk->data.join.recfn, O_RDWR |
>	>>   
>	>>
>	>O_CREAT
>	> 
>	>
>	>>| O_TRUNC, 0666) ;
>	>>
>	>>slog(Slog::levelCritical) <<" RECORDING JOINNED TIME SLOT : "<<
>	>>trunk->data.join.recfn<<endl;
>	>>
>	>>dx_clrdigbuf(chdev);
>	>>
>	>>slog(Slog::levelDebug) <<"dx_recm("<<chdev<<")"<<endl;
>	>>if(dx_recm(chdev, &iott[1], &tpt, EV_ASYNC | flags , &rtsinfo) == -1)
>	>>   
>	>>
>	>{
>	> 
>	>
>	>> slog(Slog::levelError) << "dxrecm() error" << endl;
>	>>}
>	>>slog(Slog::levelDebug) <<"dx_recm("<<chdev<<")=SUCCESS"<<endl;
>	>>
>	>>
>	>>/*
>	>>if(dx_recm(chdev, &trunk->iofile, dialogicivr.getPlayTPT(),
>	>>   EV_ASYNC | flags, &rtsinfo) < 0)
>	>>   slog(Slog::levelError) << "dxrecm() error" << endl;
>	>>*/
>	>>
>	>>   //  postError(chdev, "vox");
>	>>
>	>>}
>	>>return true;
>	>>}
>	>>
>	>>
>	>>
>	>>-----Original Message-----
>	>>From: Tristan [mailto:[email protected]]
>	>>Sent: February 8, 2006 11:22 AM
>	>>To: Julien Chavanton
>	>>Cc: [email protected]
>	>>Subject: Re: [Bayonne-devel] Record with bayonne 1.2.15 And AudioFeed
>	>>Question
>	>>
>	>>Hi,
>	>>
>	>>Seems like i have trouble using join %thesessionidtojoin record=%myfile
>	>>( maybe I have to use %session.parent instead of an other var ? )
>	>>
>	>>
>	>>Looking at /var/lib/bayonne, I see the files i'm trying to record but
>	>>their size is very often 65kB  or not a lot more
>	>>and the record is 10-15s instead of the 10min+ it is supposed to be...
>	>>
>	>>Am I missing something to get it work ?
>	>>
>	>>The sound is also very noisy and I'm not sure to hear the two person on
>	>>   
>	>>
>	>
>	> 
>	>
>	>>the phone ...
>	>>
>	>>Is it limited to 1 record for all lines I have or does it have some
>	>>limitation I can't see ?
>	>>
>	>>Do you think I can record the two ends of a join and share it with
>	>>multiple listener ?
>	>>
>	>>Thanks in advance!
>	>>
>	>>Tristan
>	>>
>	>>Julien Chavanton wrote:
>	>>
>	>>
>	>>
>	>>   
>	>>
>	>>>You will not be able to do a duplex recording with record command; it
>	>>>will only record the audio you are receiving on the channel binded to
>	>>>the script.
>	>>>
>	>>>Fortunatly you can achieve this by doing a join record.
>	>>>join %session.parent record=%recfile
>	>>>
>	>>>
>	>>>This is probably not a limitation for what you are doing, but you can
>	>>>not use the voice resource to play audio while you are recording but
>	>>>there is another alternative for doing this.
>	>>>
>	>>>Julien
>	>>>
>	>>>
>	>>>-----Original Message-----
>	>>>From:
>	>>>     
>	>>>
>	>bayonne-devel-bounces+j.chavanton=oneworldinteractive.com@gnu.org
>	> 
>	>
>	>>>[mailto:bayonne-devel-bounces+j.chavanton=oneworldinteractive.com@gnu.
>	>>>     
>	>>>
>	>o
>	> 
>	>
>	>>>  
>	>>>
>	>>>     
>	>>>
>	>>r
>	>>
>	>>
>	>>   
>	>>
>	>>>g] On Behalf Of Tristan
>	>>>Sent: January 18, 2006 11:41 AM
>	>>>To: [email protected]
>	>>>Subject: [Bayonne-devel] Record with bayonne 1.2.15
>	>>>
>	>>>Hi,
>	>>>
>	>>>I write because I have some troubles with the record command in
>	>>>ccscript.
>	>>>
>	>>>I need to record conversation that customers have with our technical
>	>>>support.
>	>>>
>	>>>I use dialogic cards ( D120JCT and D41E to do outgoing calls to the
>	>>>technical support and incoming calls are taken on a D300 PCI ).
>	>>>The join works like a charm but with the command wait timeout=10s
>	>>>record="/path/to/myfile" I only record the technical support answer
>	>>>     
>	>>>
>	>but
>	> 
>	>
>	>>>  
>	>>>
>	>>>     
>	>>>
>	>>
>	>>
>	>>   
>	>>
>	>>>can't record the customer voice.
>	>>>
>	>>>I tried with join record="afile" but nothing happens.
>	>>>
>	>>>Searched the manual but don't found anything relevant.
>	>>>
>	>>>Has someone an idea please on how to do it or is it impossible ?
>	>>>
>	>>>The point is that it was working flawless with the same hardware with
>	>>>  
>	>>>
>	>>>     
>	>>>
>	>>an
>	>>
>	>>
>	>>   
>	>>
>	>>>other IVR soft ( GAP for those who heard about it ), but GAP is not as
>	>>>     
>	>>>
>	>
>	> 
>	>
>	>>>good as bayonne for my production needs.
>	>>>
>	>>>Thanks in advance for help !
>	>>>
>	>>>Cheers
>	>>>
>	>>>
>	>>>_______________________________________________
>	>>>Bayonne-devel mailing list
>	>>>[email protected]
>	>>>http://lists.gnu.org/mailman/listinfo/bayonne-devel
>	>>>
>	>>>
>	>>>
>	>>>  
>	>>>
>	>>>     
>	>>>
>	>>
>	>>
>	>>   
>	>>
>	>
>	> 
>	>
>	
>	
>	
>
>  
>