incoming-call-pickup subscription works in sandbox but not production
Tags: sdk
Feb 14, 2019 at 9:09am • 3 replies • 0 likes
kevin-nading
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.
3 Answers
Actually let me post the entire code here. It is not long though.
Put this in your .env file and complete with your credentials:
Remember to create an empty subid.txt file!
Let me know,
+ Phong
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
0
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
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
0
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
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
1
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder