Variable Length issue Asterisk-18.20.0

Hi everyone, we are encountering an issue when sending a large amount of data in an asterisk variable using the originate command. We are receiving the error message “Line too long: Variable:

Sending following data to originate

    [Channel] => SIP/2132942943@Term
    [Exten] => 2132942943
    [Context] => ib_dial
    [Priority] => 1
    [Timeout] => 60000
    [CallerID] => name <12345678911>
    [Variable] => __usr_id=1,__campaign_id=203,__spool_id=190,__call_contact=2132942943,__call_method=outbound,__call_status=initiated,__call_error=,__contact_contact_id=98,__contact_first_name=fax,__contact_last_name=toy,__contact_phone=2132942943,,__contact_address=asdasdasasd asdasd,__contact_disposition_id=,__contact_custom1=12123,__contact_custom2=asdas,__contact_custom3=12312sdd,__contact_custom4=Hello  This is your local library calling. Our records indicate that you have an overdue item item_name due at the ap1 location by November 07  2023. Please return these items as soon as possible. Thank you  goodbye,__contact_custom5=12312312,__contact_custom6=asdasd,__contact_custom7=123123,__contact_custom8=asdasdas,__contact_contact_data_id=,__contact_date_created=1699375570,__contact_created_by=1,__contact_last_updated=1699432965,__contact_updated_by=1,__contact_custom9=sk-SK-Standard-A,__contact_custom10=sk-SK,__campaign_name=333_41th_copy,__campaign_callerid=12345678911,__campaign_callerid_name=name,__trunk_id=1
    [Account] => 203
    [Async] => true
    [ActionID] => 203

System Information
Asterisk 18.4.0
OS = RockyLinyx 8


There is a hardcoded fixed length of a single AMI line in the implementation, it is 1025, which is 1024 + 1 byte for NULL terminator.

IIRC, the limit for a channel variable in an AGI is 1023.

1 Like

Yes, there is a maximum limit, so we cannot exceed. Any solution for it?

Best Regards
Kashif Majeed

I would change the value on this line: char inbuf[1025]; in manager.c (and recompile).

Multiple Variable headers are also permitted in AMI so they don’t need to exist on a single line, of course the library in use has to support. that as well.

1 Like

Thanks, we recompile and then test it accordingly.

Best Regards
Kashif Majeed

@sedwards thank you ! This just saved me hours of debugging

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.