[asterisk-bugs] [JIRA] (ASTERISK-26728) Unique channel names per server

Andreas Krüger (JIRA) noreply at issues.asterisk.org
Thu Jan 19 03:48:10 CST 2017


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=234724#comment-234724 ] 

Andreas Krüger commented on ASTERISK-26728:
-------------------------------------------

Hi @jcolp (Joshua),

Thanks you for the reply to this. I am not sure I agree with you. Looking into the documentation at https://wiki.asterisk.org/wiki/display/AST/Using+the+CONTEXT,+EXTEN,+PRIORITY,+UNIQUEID,+and+CHANNEL+Variables , it says that:

"The UNIQUEID is in the form of 1267568856.11, where 1267568856 is the Unix epoch, and 11 shows that this is the eleventh call on the Asterisk system since it was last restarted."

I cannot see how settings the systemname would make it globally unique.

Restarting two servers at the same time, would result in the same epoch and channel count?

Further. How do you get / lookup a channel if you only have the uniqueid via AEL/AMI etc.

> Unique channel names per server
> -------------------------------
>
>                 Key: ASTERISK-26728
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26728
>             Project: Asterisk
>          Issue Type: Improvement
>      Security Level: None
>          Components: Channels/chan_pjsip
>    Affects Versions: 13.13.1, 14.2.1
>            Reporter: Andreas Krüger
>            Severity: Critical
>
> We ran into a interesting issue today. We have two servers who both share the same mysql database as backend and are working as a gateway between external calls and internal calls. When people ring, a ODBC write event adds the channel to our database so we can see which active channels / calls there is.
> Suddenly our data seemed corrupted and the system misbehaved a lot.
> Tracking down the issue is that the same SIP trunk is shared on both servers due to the servers sharing the database. As we restarted both servers at the same time, the channel names was made of the sip/endpoint name and a channel counter. But as the have the same name and the counter was reset on the same time (due to restart), both servers actually made the same channel names and not unique names.
> Our current fix is currently to modify the chan_pjsip.c file before compile and change the 
> {code}
> // Line 71
> static unsigned int chan_idx;
> {code}
> and set a random start number (seeding the server) etc:
> {code}
> // Line 71
> static unsigned int chan_idx = 0x5000;
> {code}
> Ideally you would add something server specific (id, uuid) or something to the channel name.
> My suggestion would be to alter the chan_pjsip_new function in chan_pjsip.c.
> I would suspect the place to alter would be this:
> https://github.com/asterisk/asterisk/blob/master/channels/chan_pjsip.c#L456
> Reference file is: https://github.com/asterisk/asterisk/blob/master/channels/chan_pjsip.c



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list