Esempio n. 1
0
def sendsms():
	phoneno = request.args.get('phoneno')
	print(phoneno)
	code = id_generator()	
	print(code)
	client = Exotel('punchitio','2771852343d707d6673d077656c1e27bf857a32e')
	client.sms('07930256894',phoneno,code)
	print("sms")
 	return code
Esempio n. 2
0
def sendsms():
    phoneno = request.args.get('phoneno')
    print(phoneno)
    code = id_generator()
    print(code)
    client = Exotel('punchitio', '2771852343d707d6673d077656c1e27bf857a32e')
    client.sms('07930256894', phoneno, code)
    print("sms")
    return code
Esempio n. 3
0
    def alert(self, matches):
        client = Exotel(self.exotel_account_sid, self.exotel_auth_token)

        try:
            message_body = self.rule['name'] + self.sms_body
            response = client.sms(self.rule['exotel_from_number'], self.rule['exotel_to_number'], message_body)
            if response != 200:
                raise EAException("Error posting to Exotel, response code is %s" % response)
        except RequestException:
            raise EAException("Error posting to Exotel").with_traceback(sys.exc_info()[2])
        elastalert_logger.info("Trigger sent to Exotel")
Esempio n. 4
0
def sendsms():
	phoneno = request.args.get('phoneno')
	print(phoneno)
	code = id_generator()	
	print(code)

	#url = 'https://*****:*****@twilix.exotel.in/v1/Accounts/punchitio/Sms/send'
	#data = '{"query":{"bool":{"must":[From:"07930256894",To:"'+phoneno+'",Body="'+code+'"]}'
	client = Exotel('punchitio','2771852343d707d6673d077656c1e27bf857a32e')
	client.sms('07930256894',phoneno,code)
	print("sms")
 	return code
Esempio n. 5
0
def sendsms():
    phoneno = request.args.get('phoneno')
    print(phoneno)
    code = id_generator()
    print(code)

    #url = 'https://*****:*****@twilix.exotel.in/v1/Accounts/punchitio/Sms/send'
    #data = '{"query":{"bool":{"must":[From:"07930256894",To:"'+phoneno+'",Body="'+code+'"]}'
    client = Exotel('punchitio', '2771852343d707d6673d077656c1e27bf857a32e')
    client.sms('07930256894', phoneno, code)
    print("sms")
    return code
Esempio n. 6
0
def test_sms_details(mock_http):
    mock_http.register_uri(
        'GET',
        'https://twilix.exotel.in/v1/Accounts/123/Sms/Messages/234.json',
        text=''.join((
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<TwilioResponse>',
            '<Call>...</Call>',
            '</TwilioResponse>',
        )),
    )
    e = Exotel(sid='123', token='abc')
    rep = e.sms_details(sms_sid='234')
    assert rep.status_code == 200
Esempio n. 7
0
def test_sms(mock_http):
    mock_http.register_uri(
        'POST',
        'https://twilix.exotel.in/v1/Accounts/123/Sms/send.json',
        text=''.join((
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<TwilioResponse>',
            '<SMSMessage>...</SMSMessage>',
            '</TwilioResponse>',
        )),
    )
    e = Exotel(sid='123', token='abc')
    rep = e.sms(
        from_number='012-345-6789',
        to='345-678-9012',
        body='Hello, world!',
    )
    assert rep.status_code == 200
Esempio n. 8
0
def test_call_number(mock_http):
    mock_http.register_uri(
        'POST',
        'https://twilix.exotel.in/v1/Accounts/123/Calls/connect.json',
        text=''.join((
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<TwilioResponse>',
            '<Call>...</Call>',
            '</TwilioResponse>',
        )),
    )
    e = Exotel(sid='123', token='abc')
    rep = e.call_number(
        from_number='012-345-6789',
        to='345-678-9012',
        caller_id='678-901-2345',
    )
    assert rep.status_code == 200