Hi Asterisk Experts,
AGI script take more than 3s to launch during high traffic (40 calls simultaneously)
The description is as below
- Dial Plan: Having a AGI to count the channels in Asterisk
AGI call a API, API to count the channel and return the number of channels to AGI - Having script to send 40 calls to Asterisk
*Notes: Our Customer set the script to cancel the call if no response in 3 seconds
Results: 37 call passed, around 3 calls are failed intermittently (sometimes 40 calls passed)
We checked the asterisk log and found that some times, it take more than 3 seconds to launch and process the AGI.
Here is AGI log: As you can see below – API responded to AGI within miliseconds
2023-03-17 07:08:18,744 INFO 0312340038 channelCount.py 25 Start AGI script
2023-03-17 07:08:18,744 INFO 0312340038 channelCount.py 32 Request url: http://pbx3.collabosdev-internal.tokyo:80/api/v1/cpm/channels
2023-03-17 07:08:18,744 INFO 0312340038 channelCount.py 44 Request params: {‘TenantId’: 8001, ‘ProjectId’: 80011203}
2023-03-17 07:08:18,745 DEBUG 0312340038 channelCount.py 232 Starting new HTTP connection (1): pbx3.collabosdev-internal.tokyo:80
2023-03-17 07:08:18,772 DEBUG 0312340038 channelCount.py 465 http://pbx3.collabosdev-internal.tokyo:80 “POST /api/v1/cpm/channels HTTP/1.1” 200 77
2023-03-17 07:08:18,773 INFO 0312340038 channelCount.py 51 Status code: 200
2023-03-17 07:08:18,773 INFO 0312340038 channelCount.py 68 {‘ResultCode’: ‘0000’, ‘TenantChannelCounts’: 39, ‘ProjectChannelCounts’: 39}
Below is Asterisk console logs:
Please see the highlighed in bold below and AGI log above
You can see AGI started at 07:08:15 but AGI log above, it started at 07:08:18, 3 seconds later
Do we have any limitation with AGI ?
How to know whether this is a AGI issue or something else?
I attached the log for both case Failed and Passed, and also AGI script
Case Failed: here is the channel: provider_adjustone_0363390002-00000d5f –
Failed.txt (4.6 MB)
Case Passed: provider_adjustone_0363390002-00001c7c
Passed.txt (4.8 MB)
AGI script: channelCount.txt (2.5 KB)
Any advice/solution you could provide would be high appricated
*Notes: we are using VM with 32G RAM and 4CPU, we monitored the asterisk RAM and CPU
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_request: /var/lib/asterisk/agi-bin/pyst2/channelCount.py
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_channel: PJSIP/provider_adjustone_0363390002-00000d5f
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_language: en
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_type: PJSIP
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_uniqueid: 1679036895.3641
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_version: 18.14.0
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_callerid: 0312340038
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_calleridname: unknown
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_callingpres: 0
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_callingani2: 0
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_callington: 0
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_callingtns: 0
[Mar 17 07:08:15] DEBUG[9324] manager.c: Examining AMI event:
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_dnid: 0363390002
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_rdnis: unknown
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_context: from-trunk
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_extension: 8001202_0
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_priority: 2
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_enhanced: 0.0
*[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_accountcode: *
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_threadid: 139984879376128
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_arg_1: 80011203
[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> agi_arg_2: 8001
*[Mar 17 07:08:15] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> *
||Line 159141: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Rx << VERBOSE {‘ResultCode’: ‘0000’, ‘TenantChannelCounts’: 39, ‘ProjectChannelCounts’: 39} 1|
|—|—|
||Line 159143: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> 200 result=1|
||Line 160064: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Rx << VERBOSE Normalty 1|
|—|—|
||Line 160066: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> 200 result=1|
||Line 160987: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Rx << SET VARIABLE number_active_channels_tenant 39|
|—|—|
||Line 160988: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Tx >> 200 result=1|
||Line 162844: [Mar 17 07:08:18] DEBUG[29472][C-00000c63] res_agi.c: PJSIP/provider_adjustone_0363390002-00000d5f hungup|
|—|—|
||Line 163493: [Mar 17 07:08:18] VERBOSE[29472][C-00000c63] res_agi.c: <PJSIP/provider_adjustone_0363390002-00000d5f>AGI Script /var/lib/asterisk/agi-bin/pyst2/channelCount.py completed, returning 4|