asterisk

How to add custom information to CEL records for a call?


With a CDR, is easy to add a custom field.

[exit]
exten = s,1,NoOp()
same => n,Set(CDR(my_custom_field)=${SOME_VARIABLE})
same => n,Dial(PJSIP/phone1&DAHDI/17,30,tTkK)
same => n,Hangup()

All I have to do is add my_custom_field as a column to the cdr table and it will be populated.

I want to replicate this with CEL, but altering the table and setting the CHANNEL(my_custom_field) item doesn't work, the column is always NULL. I can use this:

same => n,Set(CHANNEL(userfield)=${SOME_VARIABLE})

But I want to use a custom field name.


Solution

  • Yes, you can add custom CEL event. But you can't add column. You can add event(new row)

    CELGenUserEvent(event-name,[extra])
    

    Extra can be any text you want.

    https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_CELGenUserEvent

    After that you can parse your CEL table and update any field you want to update.