question

kevin-nading avatar image
kevin-nading asked ·

incoming-call-pickup subscription works in sandbox but not production

so I have used the ringcentral python sdk example to make a subscription to the incoming call event. it works great using the sandbox credentials. the app was approved for production. however, when i use the production url and credentials for a valid extension(my desk phone) it does not work.. no error, nothing.. i confirmed the login credentials are correct but it acts as tho no call is coming in when there is a call coming in because my phone is ringing.
topic-default
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered ·
Hi Kevin,

Can you post the complete filter you registered for notification?

Something like this "/restapi/v1.0/account/{accountId}/extension/{extensionId}/incoming-call-pickup"

I am afraid that in your sandbox, you login with the admin role and you can get notification for all extensions. And in your production, you might login with a standard user so make sure the incoming call is for that extension only. But this is just my guess. So please post some code and maybe print the log to see if some error happenned.

+ Phong
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

kevin-nading avatar image
kevin-nading answered ·
Hi Phong,

You are correct, thats the exact and complete "filter" i am using.

Yes, in the production I am logging into my own phone with my own credentials to get calls just for my own extension. The incoming call is from an outside line calling into my direct line. I did not try calling into the main line and dialing my extension, I surely would hope its not limited to just extensions dials and not direct line dials.

BTW, my user is a super admin over the entire system which should weed out any permission problems?

thank you for your prompt reply!

Kevin

3 comments Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

I just tried dialing my line from an internal phone using just the extension and it also did not call the event. there are no errors
0 Likes 0 · ·
That's weird, I just try my code and it works well with my production extension.

In your case, do you use PubNub or WebHook type? Any error/exception or just nothing happens?

Give my your  email address so I can send you my test code.

+ Phong
0 Likes 0 · ·
using pubnub:
---------------------------------
    def pubnub():
        try:
            s = sdk.create_subscription()     
            s.add_events(['/account/~/extension/~/incoming-call-pickup'])
            s.on(Events.notification, on_message)
            s.register()
----------------------------------
kevinnading@teamsdp.com

no error, just nothing happens as if no call comes in

thank you!
 
                  
0 Likes 0 · ·
Phong Vu avatar image
Phong Vu answered ·
Actually let me post the entire code here. It is not long though.

Put this in your .env file and complete with your credentials:

ENVIRONMENT_MODE=production CLIENT_ID_SB= CLIENT_SECRET_SB=  USERNAME_SB= PASSWORD_SB=  CLIENT_ID_PROD= CLIENT_SECRET_PROD=  USERNAME_PROD= PASSWORD_PROD= 
Then here is the .py code:

from multiprocessing import Process from time import sleep from ringcentral.subscription import Events from ringcentral import SDK  import os from dotenv import Dotenv dotenv = Dotenv(".env") os.environ.update(dotenv)   def main():     if os.getenv("ENVIRONMENT_MODE") == "sandbox":         sdk = SDK(os.getenv("CLIENT_ID_SB"), os.getenv("CLIENT_SECRET_SB"), 'https://platform.devtest.ringcentral.com')         platform = sdk.platform()         fromNumber = os.getenv("USERNAME_SB")         platform.login(os.getenv("USERNAME_SB"), '', os.getenv("PASSWORD_SB"))     else:         sdk = SDK(os.getenv("CLIENT_ID_PROD"), os.getenv("CLIENT_SECRET_PROD"), 'https://platform.ringcentral.com')         platform = sdk.platform()         fromNumber = os.getenv("USERNAME_PROD")         platform.login(os.getenv("USERNAME_PROD"), '', os.getenv("PASSWORD_PROD"))      def on_message(msg):         print (msg)         print(msg['uuid'])      def pubnub():         try:             s = sdk.create_subscription()             #s.add_events(['/account/~/extension/~/message-store/instant?type=SMS'])             #s.add_events(['/restapi/v1.0/account/~/presence'])             s.add_events(['/restapi/v1.0/account/~/extension/~/incoming-call-pickup'])             s.on(Events.notification, on_message)             res = s.register()             try:                 f = open("subid.txt", "w")                 print (res.json().id)                 f.write(res.json().id)                 f.close()             except Exception as e:                 print (e)             while True:                 sleep(0.1)          except KeyboardInterrupt:             print("Pubnub listener stopped...")      def unregister():         try:             f = open("subid.txt", "r")             subId = f.read()             f.close()             if (len(subId)):                 response = platform.delete('/restapi/v1.0/subscription/%s' % (subId))                 print ("Cancelled old subscription.")             else:                 print ("empty")         except Exception as e:             print (e)      p = Process(target=pubnub)      try:         unregister()         p.start()     except KeyboardInterrupt:         p.terminate()         print("Stopped by User")      print("Wait for notification...")   if __name__ == '__main__':     main() 

Remember to create an empty subid.txt file!
Let me know,
+ Phong
19 comments Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

thanks i will try yours out and let you know.
0 Likes 0 · ·
ok so i got yours to work after i removed the dotenv stuff that got me locked out of my account. however its the same result.. acts like no calls are coming thru
0 Likes 0 · ·
305 is not a valid extension id. It is probably your extension number. extension id is an internal id with 9 digits.

Can you try to make call to the main company number then when prompted for an extension, enter the extension number e.g. 305.

If you call from the RC soft phone, dial the company number followed by  * and the extension number e.g. *101 
1 Like 1 · ·
Hi Kevin, 

Please ensure that Users have "Notify my Soft Clients" setting enabled. If you an admin, then go to Service Web -> Users -> User -> Call Handling & Forwarding ->  User Hours -> My Desktop & Mobile Apps toggle. 

Also, we have another API for User's Telephony state changes, did you try Presence API and notifications? It allows to subscribe on account Presence changes within single event filter. 

Thanks,
Igor
1 Like 1 · ·
Thank you Igor, that was exactly the problem. I enabled the "desktop and mobile apps" on that extension and now it works. Sure hope you add that into the documentation so the next guy doesnt spend 2 weeks trying to figure it out. thanks again, and thank you Phong also!
1 Like 1 · ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.