ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Asterisk 16/18 with push notification

    IT Discussion
    asterisk voip telephony sip telephony voip
    3
    23
    3.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rickygm
      last edited by

      Hi forum, I am writing here to ask for help in case someone has already gone through this, I have problems in a couple of points, I am trying to install/use the push library from https://github.com/balusreekanth/ios-asterisk-push , I have a couple of asterisk 16 and 18 , no (freepbx - issabel) , and many clients are external , most of them use the grandstream wave lite in IOS phone app , the repo scripts are based on chan_sip registry , I have modified them for PJSIP but I can't get them to work.

      Point one

      I debug the script when an extension registers and I see that it finds the values, but it does not insert them in the mysql db.

      I share the logs:

      https://pastebin.com/V3kPhYBY

      the modification of the script:

      https://pastebin.com/CBK7Liyy

      Point two

      trying to adapt the part of the dialplan in point 7 of the github guide trying to adapt the dialplan part in point 7 of the github guide https://github.com/hboetes/ios-asterisk-push

      same => n,GoSubIf($["${pushneed}" = "${CALL_DESTINATION}"]?push,s,1(${CURRENT_DEVICE}))

      [push]
      exten => s,1,NoOP(SUB: Send push notification)
      same => n,Set(MAX_TRIES=15)
      same => n,Set(TRY=1)
      ;send args to push script

      same => n,System(/var/lib/asterisk/pushscripts/push "${CALL_DESTINATION}" "${CALLERID(num)}" "${CALLERID(name)}" )

      my dialplan

      exten => _2XXX,1,NoOp(${CALLERID(name)})
      exten => _2XXX,n,Noop(Protocolo TLS = ${CHANNEL(pjsip,secure)})
      exten => _2XXX,n,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})},30,tT)
      same=> n,Gosub(voicemail,s,1(${EXTEN}))
      same=> n,Hangup

      [voicemail]

      exten => s,1,Goto(s-${DIALSTATUS},1)
      exten => s-BUSY,1,Voicemail(${ARG1}@default,b)
      same => n,Hangup
      exten => s-CANCEL,1,Hangup
      exten => s-CONGESTION,1,Congestion
      same => n,Hangup
      exten => _s-.,1,Voicemail(${ARG1}@default,u)
      same => n,Hangup

      injecting my dialplan

      exten => _2XXX,1,NoOp(${CALLERID(name)})
      exten => _2XXX,n,Noop(Protocolo TLS = ${CHANNEL(pjsip,secure)})
      same=> n,GoSubIf($["${pushneed}" = "${EXTEN}) "]?push,s,1(${CURRENT_DEVICE}))
      exten => _2XXX,n,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})},30,tT)
      same=> n,Gosub(voicemail,s,1(${EXTEN}))
      same=> n,Hangup

      [push]
      exten => s,1,NoOP(SUB: Send push notification)
      same=> n,Set(MAX_TRIES=15)
      same=> n,Set(TRY=1)

      ;send args to push script

      same=> n,System(/var/lib/asterisk/pushscripts/push “${EXTEN}” “${CALLERID(num)}” “${CALLERID(name)}” )

      [voicemail]
      exten => s,1,Goto(s-${DIALSTATUS},1)
      exten => s-BUSY,1,Voicemail(${ARG1}@default,b)
      same => n,Hangup
      exten => s-CANCEL,1,Hangup
      exten => s-CONGESTION,1,Congestion
      same => n,Hangup
      exten => _s-.,1,Voicemail(${ARG1}@default,u)
      same => n,Hangup

      making a call, I see in 0 the variable
      Executing [2001@llamadas-inter:2] NoOp(“PJSIP/2000-0000001d”, “Protocolo TLS = 0”) in new stack
      – Executing [2001@llamadas-inter:3] GosubIf(“PJSIP/2000-0000001d”, “0?push,s,1()”) in new stack

      Any ideas on how to improve this dialplan?

      Note: I hope that someone can give me feedback on this, I find this library interesting so as not to depend on a third party.

      JaredBuschJ S 2 Replies Last reply Reply Quote 0
      • JaredBuschJ
        JaredBusch @rickygm
        last edited by

        @rickygm assuming this isn’t spam, I am on vacation this week. I won’t be looking into it anytime soon.

        R S 2 Replies Last reply Reply Quote 0
        • R
          rickygm @JaredBusch
          last edited by rickygm

          @jaredbusch it's not spam my friend, it's a real problem 🙂 , I would be grateful for help.

          1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch
            last edited by

            @rickygm said in Asterisk 16/18 with push notification:

            @jaredbusch it's not spam my friend, it's a real problem 🙂 , I would be grateful for help.

            I'm home now and looked at this briefly.
            Interesting solution.

            Honestly, I would need to look at the results of this original script on a CHAN_SIP system before I could troubleshoot a CHAN_PJSIP system.

            The original script is tailing the log for SIP registrations and then piping the peer detials into a sed command that makes no sense.

            TK=$(asterisk -r -x "sip show peer $US" | sed -n "s/.*pn-prid=\(.*\):remote&.*/\1/p")
            

            What is pn-prid in the return of a sip show peer XXX? Because that value is what it is looking for. The only system I have current access to with chan_sip in use, only uses it for a trunk and that does not contain pn-pid.

            R 1 Reply Last reply Reply Quote 0
            • JaredBuschJ
              JaredBusch
              last edited by

              Based on what you did to the script, it appears it may be the PJSIP AOR?

              R 1 Reply Last reply Reply Quote 0
              • R
                rickygm @JaredBusch
                last edited by rickygm

                @jaredbusch Hi jaredbusch , I set up an environment with asterisk 13 and chan_sip to see if it worked, but it doesn't work either, it doesn't save the records in the mysql db, I thought I had something wrong in the script modified for pjsip, the project is based on FreePbx, I have asked the developer on github but he doesn't answer about the MySQL db.

                JaredBuschJ 1 Reply Last reply Reply Quote 0
                • R
                  rickygm @JaredBusch
                  last edited by

                  @jaredbusch yes, this is the data with which the endpoint could be contacted.

                  1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch @rickygm
                    last edited by

                    @rickygm said in Asterisk 16/18 with push notification:

                    I set up an environment with asterisk 13 and chan_sip

                    From the command line on this system:

                    ## replace NNN with a vaild, registered extension
                    
                    rasterisk -x 'sip show peer NNN' | pastebin
                    

                    Then post the pastebin link here.

                    R 2 Replies Last reply Reply Quote 0
                    • R
                      rickygm @JaredBusch
                      last edited by

                      @jaredbusch said in Asterisk 16/18 with push notification:

                      @rickygm said in Asterisk 16/18 with push notification:

                      I set up an environment with asterisk 13 and chan_sip

                      From the command line on this system:

                      ## replace NNN with a vaild, registered extension
                      
                      rasterisk -x 'sip show peer NNN' | pastebin
                      

                      Then post the pastebin link here.

                      Ok JaredBusch , share the link of script

                      https://pastebin.com/CBK7Liyy

                      and debug

                      https://pastebin.com/V3kPhYBY

                      1 Reply Last reply Reply Quote 0
                      • R
                        rickygm @JaredBusch
                        last edited by

                        @jaredbusch said in Asterisk 16/18 with push notification:

                        @rickygm said in Asterisk 16/18 with push notification:

                        I set up an environment with asterisk 13 and chan_sip

                        From the command line on this system:

                        ## replace NNN with a vaild, registered extension
                        
                        rasterisk -x 'sip show peer NNN' | pastebin
                        

                        Then post the pastebin link here.

                        sorry, I misunderstood

                        from asterisk 13 and chan_sip

                        https://pastebin.com/L0xX76vD

                        from asterisk 16 and PJSIP

                        https://pastebin.com/x6F0eFzX

                        JaredBuschJ 1 Reply Last reply Reply Quote 0
                        • JaredBuschJ
                          JaredBusch @rickygm
                          last edited by

                          @rickygm said in Asterisk 16/18 with push notification:

                          from asterisk 13 and chan_sip
                          https://pastebin.com/L0xX76vD

                          That output has nothing that will match the sed statement.
                          | sed -n "s/.*pn-prid=\(.*\):remote&.*/\1/p")

                          -n suppresses output except for the matched lines if /p is present.
                          /p prints the matched lines.

                          The match is a substitution pattern because of s/.
                          The substitution is looking for a line with anything .* then pn-pid= then some content being marked as a group \(.*\) until :remote& then the rest of the line .*. That marked group is the output printed /\1/p.

                          The result of that sed statement is what is stuck into the shell variable TK

                          The variable TK is what is inserted into the database as p_info that is used for the push notification logic.

                          So until you can find out what normally follows pn-pid in a command sip show peer NNN you will never be able to make any progress converting this to pjsip. Once you know what data is returned, then you can look at various pjsip commands to find something that returns the same data.

                          R 1 Reply Last reply Reply Quote 0
                          • R
                            rickygm @JaredBusch
                            last edited by

                            @jaredbusch said in Asterisk 16/18 with push notification:

                            That output has nothing that will match the sed statement.
                            | sed -n "s/.pn-prid=(.):remote&./\1/p")
                            -n suppresses output except for the matched lines if /p is present.
                            /p prints the matched lines.
                            The match is a substitution pattern because of s/.
                            The substitution is looking for a line with anything .
                            then pn-pid= then some content being marked as a group (.) until :remote& then the rest of the line .. That marked group is the output printed /\1/p.
                            The result of that sed statement is what is stuck into the shell variable TK
                            The variable TK is what is inserted into the database as p_info that is used for the push notification logic.
                            So until you can find out what normally follows pn-pid in a command sip show peer NNN you will never be able to make any progress converting this to pjsip. Once you know what data is returned, then you can look at various pjsip commands to find something that returns the same data.

                            I will wait for the developer to respond, I wrote to him asking for the db logic.

                            JaredBuschJ 1 Reply Last reply Reply Quote 0
                            • JaredBuschJ
                              JaredBusch @rickygm
                              last edited by

                              @rickygm said in Asterisk 16/18 with push notification:

                              @jaredbusch said in Asterisk 16/18 with push notification:

                              That output has nothing that will match the sed statement.
                              | sed -n "s/.pn-prid=(.):remote&./\1/p")
                              -n suppresses output except for the matched lines if /p is present.
                              /p prints the matched lines.
                              The match is a substitution pattern because of s/.
                              The substitution is looking for a line with anything .
                              then pn-pid= then some content being marked as a group (.) until :remote& then the rest of the line .. That marked group is the output printed /\1/p.
                              The result of that sed statement is what is stuck into the shell variable TK
                              The variable TK is what is inserted into the database as p_info that is used for the push notification logic.
                              So until you can find out what normally follows pn-pid in a command sip show peer NNN you will never be able to make any progress converting this to pjsip. Once you know what data is returned, then you can look at various pjsip commands to find something that returns the same data.

                              I will wait for the developer to respond, I wrote to him asking for the db logic.

                              What I posted has nothing to do with the DB logic. You are not getting a value in your sip show peer NNN that contains anything. So you are not going to write anything to the DB.

                              You need to debug that first.

                              R 1 Reply Last reply Reply Quote 0
                              • R
                                rickygm @JaredBusch
                                last edited by

                                @jaredbusch If I am interested in knowing the logic of the db, to know what you want to capture, and what you insert, the strange thing is that in FreepBX seems to work, do you use it?

                                JaredBuschJ 1 Reply Last reply Reply Quote 0
                                • JaredBuschJ
                                  JaredBusch @rickygm
                                  last edited by JaredBusch

                                  @rickygm said in Asterisk 16/18 with push notification:

                                  @jaredbusch If I am interested in knowing the logic of the db, to know what you want to capture, and what you insert, the strange thing is that in FreepBX seems to work, do you use it?

                                  There is nothing to the database logic to be concerned with.

                                  Like any database there are 2 bits. Insertomgupdating/deleting data and reading data.

                                  In this case, shell script inserts records into i, while the Asterisk dial plan reads the database and does things if a record is found.

                                  Your problem is getting the shell script to return valid data to insert into the database table. Nothing else can do anything until you have valid data to first insert into the database.

                                  R 1 Reply Last reply Reply Quote 0
                                  • R
                                    rickygm @JaredBusch
                                    last edited by

                                    @jaredbusch ok got it, I will have to build my own script to be able to do this.

                                    JaredBuschJ 1 Reply Last reply Reply Quote 0
                                    • JaredBuschJ
                                      JaredBusch @rickygm
                                      last edited by

                                      @rickygm said in Asterisk 16/18 with push notification:

                                      @jaredbusch ok got it, I will have to build my own script to be able to do this.

                                      I have no idea how you got that out of what I said.

                                      The only thing you need to do is figure out what sip show peer NNN is supposed to return related to pn-pid. Then once that is known, it is simple enough to find a comparable item from a pjsip endpoint.

                                      R S 2 Replies Last reply Reply Quote 0
                                      • R
                                        rickygm @JaredBusch
                                        last edited by

                                        @jaredbusch yes, but I have a detail, the developer does not answer the messages, and we do not know what the pn-pid does.

                                        R 1 Reply Last reply Reply Quote 0
                                        • R
                                          rickygm @rickygm
                                          last edited by

                                          @rickygm now based on your experience, what other options are there to push with asterisk? I don't want to depend on third party services.

                                          1 Reply Last reply Reply Quote 0
                                          • S
                                            sneha @rickygm
                                            last edited by

                                            @rickygm Can you please tell me, what is the value of CALL_DESTINATION
                                            and pushneed and all variables??
                                            "${pushneed}" = "${CALL_DESTINATION}"]?

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post