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