### Description
Goal: Build a destination set from multiple contacts gathered from multiple registered AoR.
Situation: assumptions, observations:
* lookup() returns success there are registered contacts for each AoR. * All contacts have same q value. * lookup() can only be called for one AoR, there is no way to call it for multiple AoR. * If lookup() is called multiple times, only the destination set gathered by the last invocation is preserved, all other ones are overwritten. * t_load_contacts() transfers the destination set into the $xavp(tm_contacts) but like lookup() initializes that
So I am trying to find a way to store/collate all destination sets into one and parallel fork a call to all contacts from multiple AoR.
Idea: Stack all contacts in $xavp(contact_stack) with the same structure as $xavp(tm_contacts) and append it to tm_contacts.
xavp_rm("contact_stack"); # Make sure this is not defined. We are in a loop setting $var(lookupuri) to (sip:315996608@3cx-pbx.imp.ch and sip:315996608-1@157.161.4.181) {
lookup("location", "$var(lookupuri)"); t_load_contacts(0); # Now $xavp(tm_contacts) is populated $xavp(contact_stack) = $xavp(tm_contacts); # Store contact set
} xavp_rm("tm_contacts"); # Re Initialize tm_contacts to empty $xavp(tm_contacts) = $xavp(contact_stack); # Restore tm_contacts from stacked set.
xlog("L_INFO", "$cfg(route): COUNT: $cnt($xavp(tm_contacts))\n"); # Make sure, the count matches what we expect. xlog("L_INFO", "$cfg(route): Before t_next_contacts\n"); t_next_contacts(); # Load destination set => CRASH! xlog("L_INFO", "$cfg(route): After t_next_contacts\n");
Log (some more infos logged I omitted in the example above)
``` Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Auth_aor_user[0] = 315996608 Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Sigprofile[0] = local Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Lookupuri[0] = sip:315996608@3cx-pbx.imp.ch Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: LOOKUP sip:315996608@3cx-pbx.imp.ch SUCCESS!!!! Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Auth_aor_user[1] = 315996608-1 Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Sigprofile[1] = local Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Lookupuri[1] = sip:315996608-1@157.161.4.181 Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: LOOKUP sip:315996608-1@157.161.4.181 SUCCESS!!!! Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: ADD to tm_contacts Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: COUNT: 4 Dec 10 16:18:05 dev-cpereg01 kamailio[3964710]: INFO: [1 0618269314 128182546-3942836285-478214563@prt-cbl-sbc1.imp.ch 2 INVITE]<script>: LOCATION: Before t_next_contacts Dec 10 16:18:05 dev-cpereg01 kernel: [13747450.274883] traps: kamailio[3964710] general protection fault ip:55bc00e61f2b sp:7ffce62d7520 error:0 in kamailio[55bc00ba5000+457000] ```
#### Reproduction
Code above with: version: kamailio 5.7.6 (x86_64/linux) from official kamailio repository on ubuntu jammy.
#### Debugging Data
If required, I can try to enable coredumps.
#### Log Messages
Shown above
#### SIP Traffic
Probably not needed.
### Possible Solutions
None yet.