python - Twilio conference moderation and participant name -


i set moderator first user joins conference , i'm using twilio-python doc me didn't see this.

the first participant should moderator in order mute, kick, etc other 1 honest don't know if required i'm open "no need moderator this".

also know if name related token in participant in order retrieve 1 instead of sid. (didn't see in doc)

here server side code :

@app.route('/call', methods=['get', 'post']) def call():   resp           = twilio.twiml.response()   from_value     = request.values.get('from')               = request.values.get('to')   conferencename = request.values.get('conferencename')    account_sid     = os.environ.get("account_sid", account_sid)   auth_token      = os.environ.get("auth_token", auth_token)   app_sid         = os.environ.get("app_sid", app_sid)   clienttwilio  = twiliorestclient(account_sid, auth_token)  elif to.startswith("conference:"):     # allows user conference call     # client -> conference     conferenceslist = client.conferences.list(friendly_name=conferencename)    #there's no conference conferencename first person should moderator , join     if len(conferenceslist) == 0        #do somestuff set moderator [...]       resp.dial(callerid=from_value).conference(to[11:])     else:       #there's conference join       resp.dial(callerid=from_value).conference(to[11:]) 

and "name" related token/client want use retrieve participant :

     //http://foo.herokuapp.com/token?client=somename"      self.phone = [[tcdevice alloc] initwithcapabilitytoken:token delegate:self];     nsdictionary *params = @{@"to": @"conference:foo"};     self.connection = [self.phone connect:params delegate:self];         [self closenoddersview:nil];     //the user connected participant in conference, possible retrieve "somename" ? (server side route take "somename" in param) 

any clue ? :/

i found workaround use client:name , no need of moderator

a conference contains list of participant

a participant related specific call

a call contains information in , from_: client:name

@app.route('/conference_kick', methods=['get', 'post'])     def conference():       client          = twiliorestclient(account_sid, auth_token)       conferencename  = request.values.get('conferencename')       participantname = request.values.get('participantname')        index           = 0       call            = ""       # list of conference objects       conferenceslist = client.conferences.list(status="in-progress",friendly_name=conferencename)       if len(conferenceslist) == 1:         if conferenceslist[0].participants:           participants = conferenceslist[0].participants.list()           while index < len(participants):              call       = client.calls.get(participants[index].call_sid)             array = call.from_.split(':')             if participantname == array[1]:               participants[index].kick()               return json.dumps({'code' : 200, 'success':1, 'message':participantname+' kicked'})             index      += 1             return json.dumps({'code' : 101, 'success':0, 'message':participantname+' not found'})           else:           return json.dumps({'code' : 102, 'success':0, 'message':'no participants'})       else:           return json.dumps({'code' : 103, 'success':0, 'message':'no conference'}) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -