<snip>
same = n,Set(CHANNEL(hangup_handler_push)=update-cdr,s,1)
<snip>
[update-cdr]
exten = s,1,Set(ARRAY(first_item)=${HANGUPCAUSE_KEYS()})
same = n,Set(ARRAY(CDR(techcause_as_text))=${HANGUPCAUSE(${first_item},tech)})
same = n,Return()
From time to time (~5% of calls), it produces the following error:
[Oct 3 13:17:03] WARNING[803] res_odbc.c: SQL Execute returned an error: HY000: [ma-3.1.9][10.11.6-MariaDB-0+deb12u1]Field 'techcause_as_text' doesn't have a default value
Where does it come from ? How can I improve this ?
I forgot to mention in my previous question, that the system I work on has two different entries in cdr_adaptive_odbc.conf for two parallel connections to two different databases.
I wonder if the message comes from this.
I’ll search in this direction.
Without knowing what actually happened in the dialplan, one can only guess that no outgoing attempt was made, and there is no hangup cause present, so it’s empty and based on the output the field can’t be empty.
Thinking back to my original question, I omitted several details which might be important here. Here they are:
I have two parallel database connections and I’m not sure of the origin of the error message (it may relate to one data or the other as both are quite different)
I’m not sure how to use HANGUPCAUSE_KEYS() when you your dialplan voluntarily hangs a call up.
Let me re-phare my questions:
Let’s suppose you have 2 CDR adaptive connections.
In the first one, CDR are to be saved in table table1 and table1 has columns A and B.
For the second connection, CDR are saved in table2 which has columns B and C.
The dialplan sets values for A, B and C (with Set(CDR(A)=foo), etc …).
My understanding is Asterisk somehow queries each database to get the of the columns to be saved for each connection (so that editing a mapping like in cdr_custom.conf is not needed).
Is this correct ?
If positive, is there a way to control Asterisk’s reading ?
With the thereafter dialplan, is HANGUPCAUSE_KEYS() supposed to return anything when run in a hangup handler ?
exten = 123,1,Set(CHANNEL(hangup_handler_push)=update-cdr,s,1)
same = n,Answer()
same = n,Playback(tt-monkeys)
same = n,Hangup()
[update-cdr]
exten = s,1,Set(ARRAY(first_item)=${HANGUPCAUSE_KEYS()})
same = n,Set(ARRAY(CDR(techcause_as_text))=${HANGUPCAUSE(${first_item},tech)})
same = n,Return()