Asterisk round-robin memory trunk group

Uniform round-robin (circular) distribution of calls through several trunks. The trunk group is defined in the local asterisk database. Trunks can be identified by any alphanumeric key in the same family. Add and delete in any order.


asterisk round robin trunk group ru

Asterisk RealTime Web Interface

Realtime dialplan

</carousel>


MariaDB [realtimedb]> SELECT * FROM dp_trunks ORDER BY exten, priority;
+----+---------+--------+----------+--------+--------------------------------------+
| id | context | exten  | priority | app    | appdata                              |
+----+---------+--------+----------+--------+--------------------------------------+
| 14 | trunks  | DELETE |        1 | SET    | DB_DELETE(LAST/NEXT)=ignored         |
| 16 | trunks  | DELETE |        2 | RETURN |                                      |
|  1 | trunks  | _X.    |        1 | gotoif | ${DB_EXISTS(LAST/NEXT)}?3            |
| 20 | trunks  | _X.    |        2 | SET    | DB(LAST/NEXT)=1                      |
|  4 | trunks  | _X.    |        3 | SET    | arr=${DB_KEYS(TRUNKGROUP)}           |
| 17 | trunks  | _X.    |        4 | SET    | MAX=${FIELDQTY(arr,\,)}                      |
| 18 | trunks  | _X.    |        5 | SET    | i=${DB(LAST/NEXT)}                   |
| 11 | trunks  | _X.    |        6 | SET    | START=${CUT(arr,\,,${i})}            |
|  2 | trunks  | _X.    |        7 | SET    | trunkname=${DB(TRUNKGROUP/${START})} |
|  3 | trunks  | _X.    |        8 | dial   | SIP/${trunkname}/${EXTEN},10,gF      |
| 12 | trunks  | _X.    |        9 | SET    | i=$[${i} + 1]                        |
| 13 | trunks  | _X.    |       10 | gotoif | $[${i}=${MAX}]?DELETE,1              |
| 19 | trunks  | _X.    |       11 | SET    | DB(LAST/NEXT)=${i}                   |
| 15 | trunks  | _X.    |       12 | RETURN |                                      |
+----+---------+--------+----------+--------+--------------------------------------+

function 'FIELDQTY', function 'DB', function 'CUT', function 'POP'


*CLI> database show TRUNKGROUP
/TRUNKGROUP/1                           : trunkname1               
/TRUNKGROUP/2                           : trunkname2               
/TRUNKGROUP/5                           : trunkname3               
/TRUNKGROUP/8                           : trunkname4
/TRUNKGROUP/99                          : empty                
5 results found.

Call the trunk group:

 exten => _X.,1,GoSub(sub-context,${EXTEN},1)
Только авторизованные участники могут оставлять комментарии.
  • blog/asterisk_balance_routing.txt
  • Последние изменения: 2018/10/12