Asterisk PBX


  • Discourse touched me in a no-no place

    @flabdablet said:

    especially when those lies include the magic words "smart" or "easy"

    It's smart and it's easy: it's smeasy!



  • @astercrap said:

    ■■■■■■■■■■■■ (Qwell)'s in the #freepbx room (working for Digium) as is two Developers including X-Rob from yesterday.

    As the X-Rob who was mentioned in passing here, I should point out that Qwell and I both work for Sangoma. He used to be a Digium employee, but he came to the dark side.

    For those that don't know the background, that branch of AsteriskNOW was abandoned several years ago. @astercrap did the equivalent of joining the CentOS channel, and demanding help with his CentOS 3 machine.

    Lots of people told him that it was out of date, and to stop using it, and pointed out better things to use, but he insisted on continuing with his CentOS 3 equivalent.

    Not really much more we can do when someone insists on using a Model T and then wondering why it's not working like a modern car.

    @izzion said:

    I have no idea if Sangoma is going to update and properly maintain FreePBX, or drop it like a hot potato.

    I really hope they don't, because that's my full time job 8-) They seem pretty happy with us so far, which is about all I know. I'm actually in Australia, so I don't really know what's happening over there in the Northern Hemisphere. I just push buttons and break stuff. However, it's not like FreePBX is stagnating, we're amazingly active, with piles of commits happening.

    We have a proper GitHub organization that we use, and people can fork and do pull requests and stuff, and if anyone's interested in UN-WTFing a pile of PHP4 code (Edit: I meant removing. Not using. YES. BURN IT), we're slowly working our way through it 8-)


  • BINNED

    @xrobau said:

    UN-WTFing

    Hmmm....

    @xrobau said:

    PHP4



  • @xrobau said:

    We have a proper GitHub organization that we use, and people can fork and do pull requests and stuff, and if anyone's interested in UN-WTFing a pile of PHP4 code, we're slowly working our way through it 8-)

    Uhm, if you're UN-WTFing PHP4, rather than just BURNING IT WITH FIRE, I think that you are TRWTF.


  • Discourse touched me in a no-no place

    @xrobau said:

    PHP4 code

    Model T user detected! :D



  • Screw all that, tell us about your experiences in Matchbox Twenty!



  • @izzion said:

    Uhm, if you're UN-WTFing PHP4, rather than just BURNING IT WITH FIRE, I think that you are TRWTF.

    Well. I should point out that the un-WTFing is burning it with fire. I phrased that poorly. How about 'Removing and rewriting. This time with Unit Testing, and classes and namespaces, like a big boy language!'

    @blakeyrat said:

    tell us about your experiences in Matchbox Twenty!

    All you need to do is take me out, fill me full of Scotch and stand me in front of a Karaoke microphone, and I shall sing like an angel. Well. that's what I think. Other people tend to disagree.


  • :belt_onion:

    @xrobau said:

    'Removing and rewriting. This time with Unit Testing, and classes and namespaces, like a big boy language!'

    + 🔥 🐪



  • @xrobau said:

    a big boy language

    That reminds me... I still haven't written a BrainFuck-to-BIT compiler.



  • When you do, please write it in Befunge.


  • BINNED

    Necroing this because this damned thing pissed me off royally, again.

    So, most of Asterisk's configuration files (outside of the dialplan itself which uses the wonderful syntax described above) are in INI format.

    MOST.

    Some of them are special snowflakes which use a combination of INI and... whatever the fuck this thing is. One of them is voicemail.conf which holds both general voicemail configuration (in INI format), and a list of mailboxes available. The mailbox definition part looks like this:

    [context]
    100 => 1234,Fancy name,[other stuff]
    

    Where 100 is the number you can input into built-in IVR to get to the mailbox, 1234 is the password and Fancy name is... well, just a name, really, not even sure if it's ever used internally.

    Asterisk also has an API (if you want to call it that, it's writing stuff directly to telnet) to retrieve, update and insert settings.

    So here I am, adding a form to edit and add mailboxes from a web UI. I send it a GetConfig request and... I get all the values, lovely. Ok, UpdateConfig with Action set to Update... all good! Now, let's just add a call to insert a new line if it's a new mailbox...

    [context]
    123 = 456,Test
    

    Looks good, reload config... Error?

    Wait...

    [context]
    123 = 456,Test
    100 => 1234,Fancy name
    

    Do you see it? The damned thing only writes in INI format! Oh, it will update it OK, but any new value will just have a = instead of =>. And no, I don't control that, I can only tell it what to put on either side of the assignment.

    This is the second freaking gaping bug I found in the settings API in a week. Does no-one actually use this damned API, ever?



  • @Onyx said:

    Fancy name is... well, just a name, really, not even sure if it's ever used internally.

    In the event someone who sees this cares... Fancy name is used internally for the Directory (first name / last name matching) and also used as the "send to" name if you're doing e-mail alerts for voicemails.

    Also, I suspect that the API probably doesn't get used, because real OSSusers do CLI / text-configs by hand and compile from source anyway. Or just Docker the whole thing and pay someone else to host & configure it.


  • BINNED

    @izzion said:

    In the event someone who sees this cares... Fancy name is used internally for the Directory (first name / last name matching) and also used as the "send to" name if you're doing e-mail alerts for voicemails.

    Ah, cheers, making note. Guess I should have remembered the email stuff, but we handle emailing ourselves instead of using that.

    @izzion said:

    Also, I suspect that the API probably doesn't get used, because real OSSusers do CLI / text-configs by hand and compile from source anyway.

    Well, I'm fine with doing it like that too most of the time. But this is end-user interface stuff, I expected... Well, too much apparently. I think it's hight time to switch to realtime backend using a DB, this is getting too fiddly.



  • @Onyx said:

    I think it's hight time to switch to realtime backend using a DB, this is getting too fiddly.

    Be sure to stock your liquor cabinetHan Solo beer fridge first 🍿


  • BINNED

    Oh come on, how bad could it...

    I had to ask, didn't I?



  • If you're using RealTime for the stuff it's able to be wired up to (SIP Peers, Voicemail), it's not too bad.

    If you decide you're trying to use RealTime because you want the whole system to be database driven (say, for clustering purposes or to put a better front end on the configs)... well, good luck with extensions.conf

    My end pattern was to do this:

    [the_god_context]
    exten => _X.,1,Verbose(5,"Look up the everything")
    same => n,ODBCFunctionStuff()
    same => n,GotoIf($[${ODBC_FIELD_ACTION} = "cleared-function-1"]?macro-1,s,1)
    same => n,GotoIf($[${ODBC_FIELD_ACTION} = "cleared-function-2"]?macro-2,s,1)
    ...
    

    And even with just sip.conf / voicemail.conf in RealTime, some changes do require triggering a module reload from within Asterisk (and some don't! yay discoursistency!)


  • BINNED

    @izzion said:

    If you're using RealTime for the stuff it's able to be wired up to (SIP Peers, Voicemail), it's not too bad.

    That's the plan.

    @izzion said:

    If you decide you're trying to use RealTime because you want the whole system to be database driven (say, for clustering purposes or to put a better front end on the configs)... well, good luck with extensions.conf

    No, exensions.confael is fine and I won't touch it, except to fix any bugs. Any settings that I need to read from there (and are not discernible from channel variables) are stored in Asterisk's in-memory database.

    @izzion said:

    And even with just sip.conf / voicemail.conf in RealTime, some changes do require triggering a module reload from within Asterisk (and some don't! yay discoursistency!)

    I intend to just send a reload to the manager after every change. Screw it, they are not that expensive, and this stuff won't be changed that often. That's what I do right now anyway.



  • Today I learned that apparently, Asterisk has a bad time bridging together two soft phones belonging to one LAN, behind NAT, with the Asterisk server itself being on the external internets.

    Symptoms: party A calls party B. Everybody hears everybody. Then party B calls party A; party A can hear party B, but party B cannot hear a thing. Apparently this is because despite I tell Asterisk to fucking never ever use direct media, it still uses it, because it sees calls originating from the same IP address, and decides "fuck you, I'm bridging these two natively".

    At Digium, developers are either closing or ignoring tickets related to the problem out of sheer ignorance, and out of total lack of comprehension why would the administrator have a better idea how the software should be used.

    Solution? Use MixMonitor(/dev/null). When MixMonitor'ing, Asterisk cannot bridge devices natively, as it won't be able to wiretap; problem solved. But again, the software trying to outsmart its master... I should really go to Germany, take a core dev to a lunch, show him how his brillant solutions don't fucking work, and then club him in the kneecaps.

    Paging @Onyx



  • @wft, what are your sip device settings? Especially the nat= line for the impacted devices, and the localsubnet= lines for the server level?

    (as always, don't post actual device username/passwords!)


  • BINNED

    What @izzion said. Also, what version? They changed something in bridging model in 12/13, seems like you really can't stop it bridging shit directly in the local network, though I'll admit I didn't play with it that much yet.



  • It's PJSIP, so most chan_sip settings won't work.



  • Hrm. Well, I have less experience (read: none) with PJSIP. I assume you've read this wiki article: https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip+to+work+through+NAT? It looks to me like the direct_media= parameter is the equivalent of the old nat= parameter, maybe? Or there seems to be a disable_direct_media_on_nat= parameter that's referenced in other PJSIP documentation?

    Also, what parameters for the Dial application are being used when creating the call to the destination endpoint?

    What jitter buffer settings (if any) exist for these endpoints?


  • BINNED

    Today's joy, call transfers after some code refactoring:

    Note The caller ID presented to the person you are trying to transfer the call to is not what you would expect - Asterisk sets your caller ID to be the extension the call originally arrived at which may not be the same as the extension the call was answered at. There doesn't appear to be any way of getting the correct caller ID.

    So, when you dare to call the Dial() application within a switch statement in AEL, what is the caller ID?

    0_1459331093701_IMAG0013-n.jpg

    Ah, yes, because switch statements are black magic which requires GoSubIfs after Asterisk magles it back to its wonderful conf files. Sigh. Time to try switching to regular if-elseif construct, I think that gets translated to regular GotoIfs...


  • BINNED

    NECRO! This one was just too stupid to post in a random complaint thread, this needs to be archived!

    In any sane language, the following expressions:

    x=1
    x = 1
    x      =      1
    

    Are either
    a) equivalent
    b) anything other than the first one fails. Ok, that's classifying bash as "sane", which is a stretch, but you get what I mean.

    So, naturally, this is the same in Asterisk. Right? Right?

    2000 => {
        Set(x=0);
        Set(x =1);
        Set(x   =3);
    
        Verbose(1, ${x});
        Verbose(1, ${x });
        Verbose(1, ${x   });
        Hangup();
    }
    
    [2018-01-31 14:07:31] WARNING[13884][C-0000001a]: pbx_variables.c:1099 pbx_builtin_setvar: Please avoid unnecessary spaces on variables as it may lead to unexpected results ('x ' set to '1').
    [2018-01-31 14:07:31] WARNING[13884][C-0000001a]: pbx_variables.c:1099 pbx_builtin_setvar: Please avoid unnecessary spaces on variables as it may lead to unexpected results ('x   ' set to '3').
      0
      1
      3
    

    I remembered this awesome thing when, suddenly, calls started failing on our production server. I have a functionmacro that lets me kinda-sorta simulate a function having return values, and it's set up to strip any spaces, so I use that to have a bit more readable code as well, something like

    &set(longVariableName = getLongVariable());
    &set(shortVarName     = getShortVariable());
    

    Apparently, my co-worker's vim decided to replace some of the spaces with tabs on saving and... well, my variables changed from being named something like trunkB to being named something like trunkB\t\t(only they were actual tab characters, markdumb is stripping them here, hence \t).

    I think the fact that I figured out what the problem is within 5 minutes is proof enough that I'm insane beyond redemption at this point.



  • @onyx CPM, DOS, and Windows' Command Prompt are the same with SET so I picked up on that right away too.



  • As my boss would say, "I thought parsing insignificant spaces away is a solved problem for a few decades now!"

    ...You sure would hope.


  • BINNED

    @wft said in Asterisk PBX:

    As my boss would say, "I thought parsing insignificant spaces away is a solved problem for a few decades now!"

    Well, I mean, I kinda did handle it in my macro thing, probably not in the best way ever (then again, it's Asterisk's string handling functions I have to deal with)...

    macro set(p_expression)
    {
    	Set(p_expression=${STRREPLACE(p_expression, ,)});
    
    	Set(LOCAL(varname)=${SHIFT(p_expression,=)});
    	Set(LOCAL(macro)=${SHIFT(p_expression,\()});
    	Set(LOCAL(params)=${SHIFT(p_expression,\))});
    	Set(LOCAL(retname)=r_${macro});
    
    	AELSub(${macro},${EVAL(${params})});
    
    	Set(${varname}=${${retname}});
    
    	return;
    }
    

    Probably should have stripped all whitespace instead. If only I could just use \s, but noooooo....

    Also, yeah, that's the hack. It requires all the macros called by that to set a variable with the name r_<macro_name> in order for it to work, which is a pain, and no, don't bother nesting parentheses, but it beats having to use globalchannel variables for everything...


  • ♿ (Parody)

    @onyx said in Asterisk PBX:

    trunkB to being named something like trunkB\t\t

    Hah! And pythong thinks it has semantically significant whitespace!


  • Impossible Mission - B

    @onyx said in Asterisk PBX:

    Apparently, my co-worker's vim

    TRWTF located!



  • I keep wanting to ask what kind of phone equipment the ancient Gauls had...


  • BINNED

    WHAT. THE. FUCK!

    No, it's not a question, it's a statement.

    So, if you're using Asterisk's built-in queues, there are certain events you get related to that on the aforementioned AMI. There's QueueCallerJoin, which, as expected, gets emitted when a caller joins a queue. There's QueueCallerLeave which, you guessed it, gets emitted when a caller leaves the queue, for whatever reason. There's also QueueCallerAbandon which gets emitted if and only if a caller leaves the queue for any reason other than their call got answered by an agent.

    On this one specific install, QueueCallerAbandon gets emitted every time an agent doesn't pick up in time. The caller hasn't left queue. They are still there, listening to music on hold or getting a "please wait..." message. The dialplan doesn't progress (the Queue application, as all other Asterisk applications, is blocking), and there's no loop in there that would return them to queue if they truly left. If they were to leave abnormally for any reason they'd get a busy tone.

    WHY IN THE FUCK IS THERE A QueueCallerAbandon EVENT THEN?

    Fuck knows, I just know I'm fucking pissed. Fuck this shit, I need alcohol...


  • BINNED

    @onyx I may have jumped the gun. There's still WTFery going on, but Asterisk's data is actually correct.

    So, other than "This event shouldn't be there", everything else I wrote is true. What actually seems to happen is:

    1. I make a call
    2. Call enters the queue and starts ringing on the agent's phone
    3. The call to the agent times out
    4. The BYE message somehow reaches T-Scum's servers, even though it shouldn't. The reason for this may be that fucking T-Scum refuses to give us a proper trunk so we instead connected a bunch of accounts to their "NetPhone" service (which is intended to be used as a cloud PBX service where you register each phone to it individually). I should point out, T-Scum were the ones who hired us as a subcontractor here and are still a pain in the ass to get them to do things properly.
    5. T-Scum then doesn't propagate the BYE to the telco I'm using (and, subsequently, to my Asterisk install and my phone), they instead restart the call. For whatever fucking reason. I didn't realize this initially because we turned off IVR for this testing number because I don't feel like wasting a minute listening to the same spiel every time I make a test call.

    I'm now restarting Asterisk as a precaution in case it went wonky, but I used restart when convenient and someone is not getting off the fucking phone for 10 minutes now.

    EDIT: It restarted. Still the same shit.

    0_1529585360362_887c6f68-050e-454f-a17c-871f6bc906ae-image.png



  • @onyx
    The worst is when you use restart when convenient and that someone is on the phone for like a 2 hour conference call about why the phone system isn't working, and meanwhile all the test calls they're making get Congestion because the phone system is blocking all new incoming calls while waiting for them to hang the fuck up so it can restart.


  • BINNED

    @izzion said in Asterisk PBX:

    @onyx
    The worst is when you use restart when convenient and that someone is on the phone for like a 2 hour conference call about why the phone system isn't working, and meanwhile all the test calls they're making get Congestion because the phone system is blocking all new incoming calls while waiting for them to hang the fuck up so it can restart.

    That's restart gracefully, actually, restart when convenient allows new calls.



  • @onyx
    Ah, right. I knew I'd run into it with one of those two commands. Either way.


  • Discourse touched me in a no-no place

    @onyx said in Asterisk PBX:

    T-Scum

    It could be worse. It could be Vodafuck.


  • BINNED

    WTFery never stops. I'm splitting the blame now.

    So... Even with calling Answer from an AGI script and then calling Playback with default parameters, which both should send a 200 OK to the telco, it was doing that weird "hangup and restart thing". We manually added a call to Progress (basically, allows you to play audio without answering the call, it's pretty much what happens when you call someone's cellphone that's off grid and get that "The number you have dialed...") and... everything is working fine!

    So... a bug somewhere in the AGI implementation or something, yeah?

    Well... We removed that call to Progress, reloaded and... everything is still fine?

    So, :wtf:? Asterisk was probably being stupid, but so was T-Scum with the weird call restarting, if the call failed it failed, why are you restarting it? Or maybe it was stuck in some weird state and now we unstuck it by sending a 183 Session Progress at some point?

    Fuck knows. I still need alcohol.



  • @onyx I wanted to say this on the response to the first few responses but it noticed it was from 4 years ago. Seeing how you're still dealing with this shit, you owe yourself your choice of cold piss or nuclear waste before your head home. Just reading the thread gave me a head ache. I can only imagine.


  • Discourse touched me in a no-no place

    @onyx said in Asterisk PBX:

    I still need alcohol.

    I get the feeling that that's a constant, especially where Asterisk is involved…


  • BINNED

    No worries, the healing has begun.

    0_1529600883816_6834ee81-df04-432a-8515-6bf781576d04-image.png




  • BINNED

    @stillwater nope, but I wouldn't be surprised to have such a day.



  • @onyx Is that Flash Gordon in the background?


  • BINNED

    @dcon how else do you heal than by watching the best movie ever? Duh!



  • @dcon said in Asterisk PBX:

    @onyx Is that Flash Gordon in the background?

    Wow, good eye.



  • @stillwater said in Asterisk PBX:

    @onyx
    Is this you?

    That just makes me sad. If you're at the stage where you regularly drink before work, you cannot even stop drinking without medical help anymore if you wanted to.



  • @dfdub The entire site is made up of people who are super frustrated with their jobs and doing shit like this.

    @dfdub said in Asterisk PBX:

    That just makes me sad. If you're at the stage where you regularly drink before work

    I've been there and yeah it's not a pretty sight at all.



  • @stillwater
    I had a wake-up call when I had to take antidepressants for a while and realized how much I usually drink. It also made me realize that some of my friends are raging alcoholics.

    I am now trying to figure out what this whole "responsible drinking" thing is about. It's easy to slip back into old habits, but I think I'm getting there.



  • @dfdub said in Asterisk PBX:

    I had a wake-up call when I had to take antidepressants for a while and realized how much I usually drink.

    I realised this when I found myself sober one day and being sober felt NEW. Not different but completely new.

    @dfdub said in Asterisk PBX:

    that some of my friends are raging alcoholics.

    I think half the problem is peer pressure. All our jobs suck so let's drink instead of doing something productive about it. If some does BOOHOO!

    @dfdub said in Asterisk PBX:

    I am now trying to figure out what this whole "responsible drinking" thing is about. It's easy to slip back into old habits, but I think I'm getting there.

    If you don't wanna figure out the first part and want to be careful about slipping back into old habits,, I'd recommend having atleast 3/4ths of a normal meal before drinking. It has helped me fuckloads. YMMV and all that.



  • @stillwater Man I wish I were alcoholic. Anything concrete like that I could blame my loser life on that you could explain to people in a single sentence would be great.


Log in to reply