<div dir="ltr"><div>Hi, all<br></div><div><br></div><div>Sorry for null subject last mail.</div><div><br></div><div>I use Ubuntu 12.04.01 TLS and install asterisk 11.7.0 (tar.gz downloaded from <a href="http://asterisk.org">asterisk.org</a>). We named it "Asterisk11".</div>
<div>I want to generate a call file to /var/spool/asterisk/outgoing. This call will dial out to Local Channel and return to some Extens.</div><div>Then Asterisk11 will generate a CDR records to MySQL's cdr table(in database "mydatabase") via cdr_adaptive_odbc.</div>
<div>The "SIP/A221" is another asterisk machine named it "Elastix24".</div><div><br></div><div>I have two BIG QUESTIONs about cdr_adaptive_odbc.</div><div><br></div><div>First, I have answered call from Elastix24 and I can listen the music file played from Asterisk11.</div>
<div>In another word, this call should be answered and its billsec is greater than 0.</div><div><br></div><div>Second, if I don't want to use forkcdr(), how to config it and I can get another cdr record that call from SIP/A221(Elastix24) to my Exten:777777? </div>
<div><br></div><div>I know that the outgoing file will make a call to Local Channel and try to Dial SIP/A221.</div><div>If it answered, this old channel should be hangup and generate another new channel to connect to Extension:777777(my callback exten).</div>
<div><br></div><div>I can't find two cdr records in mycdr table.</div><div>mysql> select * from gvl_cdr;</div><div>+---------------------+------+-----+-------+---------------------+---------------------------------------------------+-------------------+---------+--------------------------+----------+---------+-------------+----------+-------------+-----------+--------------+--------------+----------+-------------+---------+----------+--------+</div>
<div>| calldate | clid | src | dst | dcontext | channel | dstchannel | lastapp | lastdata | duration | billsec | disposition | amaflags | accountcode | userfield | uniqueid | linkedid | sequence | peeraccount | phoneno | callerid | userid |</div>
<div>+---------------------+------+-----+-------+---------------------+---------------------------------------------------+-------------------+---------+--------------------------+----------+---------+-------------+----------+-------------+-----------+--------------+--------------+----------+-------------+---------+----------+--------+</div>
<div>| 2014-01-08 14:37:01 | | |777777 | from-internal-out-7 | Local/777777@from-internal-out-7-00000000;2 | SIP/A221-00000000 | Dial | SIP/A221/777777,30 | 17 | 0 | ANSWERED | 3 | | | 1389163021.1 | 1389163021.0 | 1 | | 777777 | | 7 |</div>
<div><br></div><div><br></div><div><br></div><div>Even I try to add ForkCDR or ResetCDR. The billsec is 0 in other record(the 3th one).</div><div>mysql> select * from gvl_cdr;</div><div>+---------------------+--------------------+---------+---------------+---------------------+----------------------------------------------------+-------------------+---------+-------------------------------+----------+---------+-------------+----------+-------------+-----------+--------------+--------------+----------+-------------+---------+----------+--------+</div>
<div>| calldate | clid | src | dst | dcontext | channel | dstchannel | lastapp | lastdata | duration | billsec | disposition | amaflags | accountcode | userfield | uniqueid | linkedid | sequence | peeraccount | phoneno | callerid | userid |</div>
<div>+---------------------+--------------------+---------+---------------+---------------------+----------------------------------------------------+-------------------+---------+-------------------------------+----------+---------+-------------+----------+-------------+-----------+--------------+--------------+----------+-------------+---------+----------+--------+</div>
<div>| 2014-01-08 14:34:04 | | | 777777 | from-internal-out-7 | Local/777777@from-internal-out-7-00000000;2 | SIP/A221-00000000 | Dial | SIP/A221/777777,30 | 15 | 0 | ANSWERED | 3 | | | 1389162844.1 | 1389162844.0 | 1 | | 777777 | | 7 |</div>
<div>| 2014-01-08 14:34:04 | "device" <1000> | 1000 | 777777 | from-6 | Local/777777@from-internal-out-7-00000000;1 | | ForkCDR | | 20 | 5 | ANSWERED | 3 | | | 1389162844.0 | 1389162844.0 | 0 | | 777777 | | 7 |</div>
<div>| 2014-01-08 14:34:24 | "device" <777777> | 777777 | 777777 | from-6 | Local/777777@from-internal-out-7-00000000;1 | | Read | CALLBACK,custom-gvl/2,1,s,1,3 | 0 | 0 | NO ANSWER | 3 | | | 1389162844.0 | 1389162844.0 | 3 | | | | 0 |</div>
<div><br></div><div><br></div><div>----------------- /var/spool/asterisk/outgoing/777777.call</div><div>Channel:Local/777777@from-internal-out-7</div><div>WaitTime:30</div><div>Context:from-6</div><div>Extension:777777</div>
<div>Priority:1</div><div>Set:CLID=</div><div>Set:EXT=777777</div><div>Set:USERID=7</div><div><br></div><div><br></div><div>-------------- /etc/asterisk/extensions.conf lists below: </div><div>[from-internal-out-7]</div><div>
exten => _X.,1,Set(CALLERID(number)=${CLID})</div><div>exten => _X.,n,Set(CDR(phoneno)=${EXT})</div><div>exten => _X.,n,Set(CDR(userid)=${USERID})</div><div>exten => _X.,n,Set(CDR(callerid)=${CLID})</div><div>
exten => _X.,n,Dial(SIP/A221/${EXTEN},30)</div><div>exten => failed,1,Hangup</div><div><br></div><div>[from-6]</div><div>exten => _X.,1,Answer()</div><div>exten => _X.,n,Set(CALLERID(number)=${EXTEN})</div><div>
exten => _X.,n,Set(CDR(phoneno)=${EXTEN})</div><div>exten => _X.,n,Set(CDR(userid)=${USERID})</div><div>exten => _X.,n,Set(CDR(callerid)=${CLID})</div><div>exten => _X.,n,Set(RETRYCOUNT=$[ 1])</div><div>exten => _X.,n(countdown),Set(RETRYCOUNT=$[ ${RETRYCOUNT} - 1])</div>
<div>exten => _X.,n(replay),Read(CALLBACK,custom-gvl/2,1,s,1,3)</div><div>exten => _X.,n,GotoIf($['${CALLBACK}'='0']?replay:pressother)</div><div>exten => _X.,n,GotoIf($[${RETRYCOUNT} > 0]?countdown:pressother)</div>
<div>exten => _X.,n(pressother),NoOp(CALLBACK:${CALLBACK})</div><div>exten => _X.,n,Hangup()</div><div><br></div><div>exten => h,1,Hangup()</div><div>exten => i,1,Hangup()</div><div> </div>
<div><br></div><div>-------------- /etc/asterisk/cdr.conf lists below: </div><div>[general]</div><div>enable=yes</div><div>unanswered = yes</div><div>congestion = yes</div><div><br></div><div>[csv]</div><div>usegmtime=no ; log date/time in GMT. Default is "no"</div>
<div>loguniqueid=yes ; log uniqueid. Default is "no"</div><div>loguserfield=yes ; log user field. Default is "no"</div><div>accountlogs=yes ; create separate log file for each account code. Default is "yes"</div>
<div><br></div><div><br></div><div>-------------- /etc/odbc.ini</div><div>[asterisk-connector]</div><div>Description = MySQL connection to 'asterisk' database</div><div>Driver = MySQL</div>
<div>Database = mydatabase</div><div>Server = localhost</div><div>UserName = root</div><div>Password = mypassword</div><div>Port = 3306</div><div>Socket = /var/run/mysqld/mysqld.sock</div>
<div><br></div><div><br></div><div>-------------- /etc/asterisk/res_odbc.conf lists below: </div><div>[ENV]</div><div><br></div><div>[asterisk]</div><div>enabled => yes</div><div>dsn => asterisk-connector</div><div>
password => mypassword</div><div>pre-connect => yes</div><div>sanitysql => select 1</div><div>idlecheck => 30</div><div>connect_timeout => 20</div><div><br></div><div><br></div><div>-------------- /etc/asterisk/cdr_adaptive_odbc.conf lists below: </div>
<div>[cdr]</div><div>connection=asterisk</div><div>table=cdr</div><div>alias start => calldate</div><div>alias phoneno => phoneno</div><div>alias userid => userid</div><div>alias callerid => callerid</div><div>
<br></div><div><br></div><div>-------------- asterisk's CLI: </div><div>ubuntu*CLI> module reload cdr_adaptive_odbc.so </div><div> -- Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)</div>
<div> == Parsing '/etc/asterisk/cdr_adaptive_odbc.conf': Found</div><div> -- Found adaptive CDR table cdr@asterisk.</div><div> -- Found alias start for column calldate in cdr@asterisk</div><div> -- Found alias phoneno for column phoneno in cdr@asterisk</div>
<div> -- Found alias callerid for column callerid in cdr@asterisk</div><div> -- Found alias userid for column userid in cdr@asterisk</div><div><br></div><div> -- Attempting call on Local/777777@from-internal-out-7 for 777777@from-6:1 (Retry 1)</div>
<div> -- Executing [777777@from-internal-out-7:1] Set("Local/777777@from-internal-out-7-00000000;2", "_FLOWID=6") in new stack</div><div> -- Executing [777777@from-internal-out-7:2] Set("Local/777777@from-internal-out-7-00000000;2", "CALLERID(number)=") in new stack</div>
<div> -- Executing [777777@from-internal-out-7:3] Set("Local/777777@from-internal-out-7-00000000;2", "CDR(phoneno)=777777") in new stack</div><div> -- Executing [777777@from-internal-out-7:4] Set("Local/777777@from-internal-out-7-00000000;2", "CDR(userid)=7") in new stack</div>
<div> -- Executing [777777@from-internal-out-7:5] Dial("Local/777777@from-internal-out-7-00000000;2", "SIP/A221/777777,30") in new stack</div><div> == Using SIP RTP CoS mark 5</div><div> -- Called SIP/A221/777777</div>
<div> -- SIP/A221-00000000 is ringing</div><div> > 0xb6c04f70 -- Probation passed - setting RTP source address to <a href="http://192.168.1.226:15396">192.168.1.226:15396</a></div><div>[Jan 8 14:37:01] WARNING[9132][C-00000000]: dsp.c:1490 ast_dsp_process: Inband DTMF is not supported on codec g729. Use RFC2833</div>
<div> -- SIP/A221-00000000 is ringing</div><div> -- SIP/A221-00000000 answered Local/777777@from-internal-out-7-00000000;2</div><div> > Channel Local/777777@from-internal-out-7-00000000;1 was answered</div>
<div> -- Executing [777777@from-6:1] Answer("Local/777777@from-internal-out-7-00000000;1", "") in new stack</div><div> -- Executing [777777@from-6:2] Set("Local/777777@from-internal-out-7-00000000;1", "CALLERID(number)=777777") in new stack</div>
<div> -- Executing [777777@from-6:3] Set("Local/777777@from-internal-out-7-00000000;1", "CDR(phoneno)=777777") in new stack</div><div> -- Executing [777777@from-6:4] Set("Local/777777@from-internal-out-7-00000000;1", "CDR(userid)=7") in new stack</div>
<div> -- Executing [777777@from-6:5] Set("Local/777777@from-internal-out-7-00000000;1", "RETRYCOUNT=1") in new stack</div><div> -- Executing [777777@from-6:6] Set("Local/777777@from-internal-out-7-00000000;1", "RETRYCOUNT=0") in new stack</div>
<div> -- Executing [777777@from-6:7] Read("Local/777777@from-internal-out-7-00000000;1", "CALLBACK,custom-gvl/2,1,s,1,3") in new stack</div><div> -- Accepting a maximum of 1 digits.</div><div> -- <Local/777777@from-internal-out-7-00000000;1> Playing 'custom-gvl/2.slin' (language 'en')</div>
<div> > 0xb6c04f70 -- Probation passed - setting RTP source address to <a href="http://192.168.1.226:15396">192.168.1.226:15396</a></div><div>[Jan 8 14:37:23] NOTICE[9132][C-00000000]: res_odbc.c:1524 odbc_obj_connect: Re-connecting asterisk</div>
<div>[Jan 8 14:37:23] NOTICE[9132][C-00000000]: res_odbc.c:1559 odbc_obj_connect: res_odbc: Connected to asterisk [asterisk-connector]</div><div> == Spawn extension (from-internal-out-7, 777777, 13) exited non-zero on 'Local/777777@from-internal-out-7-00000000;2'</div>
<div> -- User disconnected</div><div> -- Executing [h@from-6:1] Hangup("SIP/A221-00000000", "") in new stack</div><div> == Spawn extension (from-6, h, 1) exited non-zero on 'SIP/A221-00000000'</div>
<div>[Jan 8 14:37:40] NOTICE[9131]: pbx_spool.c:402 attempt_thread: Call completed to Local/777777@from-internal-out-7</div><div><br></div>-- <br>Best Regards<br>Charles<br>
</div>