PLivo hang_up and Sequential dialing - plivo

I am using plivo sequential dialing to round robin a phone call.
<?xml version = "1.0" encoding = "UTF-8"?>
<Response>
<Record maxLength="10800" action="http://example.com/recording-callback.php" startOnDialAnswer="false" redirect="false" recordSession="true" />
<Dial callerId="19515555555" timeout="15" action="http://example.com/action-webhook.php" callbackUrl="http://example.com/status-callback.php" callbackMethod="POST" >
<Number>14444444444</Number>
</Dial>
<Dial callerId="19515555555" timeout="15" action="http://example.com/action-webhook.php" callbackUrl="http://example.com/status-callback.php" callbackMethod="POST" >
<Number>15555555555</Number>
</Dial>
<Dial callerId="19515555555" timeout="15" action="http://example.com/action-webhook.php" callbackUrl="http://example.com/status-callback.php" callbackMethod="POST" >
<Number>16666666666</Number>
</Dial>
</Response>
If the second user answers then terminates the call the call will continue to the end of the xml. It will call the rest of the users even when I output hangup xml. The call only terminates completely when the dialing party has hung up. Does anyone have experience terminating a plivo phone call initiated with sequential dialing

Related

NATS does not raise an exception when disconnecting

I use an almost standard example of using NATS on python asyncio. I want to receive a message, process it, and send the result
back to the queue, but when the NATS is disconnected (e.g. reboot gnats), the exception does not raise. I even did await asyncio.sleep (1, loop = loop) to change the context
and the disconnect -> reconnect exception was thrown, but this does not happen. What am I doing wrong? May be it's a bug?
import asyncio
from nats.aio.client import Client as NATS
import time
async def run(loop):
nc = NATS()
await nc.connect(io_loop=loop)
async def message_handler(msg):
subject = msg.subject
reply = msg.reply
data = msg.data.decode()
print("Received a message on '{subject} {reply}': {data}".format(
subject=subject, reply=reply, data=data))
# Working
time.sleep(10)
# If nats disconnects at this point, the exception will not be caused
# and will be made attempt to send a message by nc.publish
await asyncio.sleep(2, loop=loop)
print("UNSLEEP")
await nc.publish("test", "test payload".encode())
print("PUBLISHED")
# Simple publisher and async subscriber via coroutine.
await nc.subscribe("foo", cb=message_handler)
while True:
await asyncio.sleep(1, loop=loop)
await nc.close()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(run(loop))
loop.close()
NATs is built on top of TCP.
TCP has no reliable disconnection signal by definition.
To solve it any messaging system should use a kind of ping messages and drop the connection if timeout occurs.
Strictly speaking you will get disconnection event sometimes, but it may take up to 2 hours (depends on your OS settings).

Kannel: how to define "source-addr-npi" and "source-addr-ton" in sendsms URL?

I have some problem with Kannel application. To one of SMSC I send messages with alpha, numeric and shortcode sender id. Every type of sender id requires different "source-addr-npi" / "source-addr-ton". I can set it only static in config, so I have created 3 similar config in my kannel.conf file with different TON/NPI settings. Supplier was give me below data as correct:
alpha: ton = 5, npi = 0
numeric: ton = 1, npi = 1
shortcode: ton = 3, npi = 13
3 binds as transceiver with the same login and password, with the same IP address and port. I can send SMS and it works but now, I have another trouble, because when I send SMS via connection1, DLR is returned by SMSC to connection1, 2 or 3 (it's random). Kannel generated error like below:
ERROR: SMPP[SMSC1]: got DLR but could not find message or was not interested in it id<80FA5E7200000002> dst<xxxxxxxx>, type<1>
Is it possible to set "source-addr-npi" and "source-addr-ton" values via HTTP request when I'm sending SMS to Kannel from my application as below?
~/cgi-bin/sendsms?smsc=aaa&username=bbb&password=ccc&source-addr-npi=1&(...)
Supplier says, that he can't do anything by his side. I have found "source-addr-autodetect" parameter but it didn't work because return for shortcode and numeric sender:
source-addr-ton = 2
source-addr-npi = 1
and my supplier return error code as below:
ERROR: SMPP[SMSC1]: SMSC returned error code 0x0000000b (Invalid Destination Address) in response to submit_sm.
Anyone can help me?
Do You know is there any "ready to use" patch for kannel for as You say "explicit TON and NPI in sendsms API"?

Duplicate Notifications are being received in appfabric caching

I am configuring notifications for my appfabric cache. The first add operation is sending one notification. But When I replace (Update) the same cache Item with a new value or delete that item, I am receiving multiple number of notifications for that single operation. I suspect that it has nothing to do with the type of operation I perform. Because I have seen multiple add notifications too. Is there any configuration I am messing up??
I have written the delegate in my codeback file. It is hitting the delegate continually for some time even for single operation.
My configuration is :
<dataCacheClient requestTimeout="150000" channelOpenTimeout="19000" maxConnectionsToServer="10">
<localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
<clientNotification pollInterval="30" maxQueueLength="10000" />
<hosts>
<host name="192.10.14.20" cachePort="22233"/>
</hosts>
<securityProperties mode="None" protectionLevel="None" />
<transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456"
maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000"
receiveTimeout="600000"/>
</dataCacheClient>
And my code which has the delegate is :
public void myCacheLvlDelegate(string myCacheName, string myRegion, string myKey, DataCacheItemVersion itemVersion, DataCacheOperations OperationId, DataCacheNotificationDescriptor nd)
{
//display some of the delegate parameters
StringBuilder ResponseOfCache = new StringBuilder("A cache-level notification was triggered!");
ResponseOfCache.Append(" ; Cache: " + myCacheName);
ResponseOfCache.Append(" ; Region: " + myRegion);
ResponseOfCache.Append(" ; Key: " + myKey);
ResponseOfCache.Append(" ; Operation: " + OperationId.ToString());
string value = ManualDataCacheOperations.GetCacheValue(myTestCache, txtKey.Text).ToString();
Legend.Append(string.Format("{0} - Operation {1} Performed at {2}{3}", myKey, OperationId.ToString(), DateTime.Now.ToShortTimeString(), Environment.NewLine));
}
Please let me know Where am I missing it?? Why is it sending multiple notifications for same item. If it is of any use, I am using a cluster with two hosts. And using same cache for session management too.
First, be sure that you added only one callback. It's simple but i've seen too much cases where multiple callbacks were added.
It's really important to understand that cache notifications are based on polling.
When you use cache notifications, your application checks with the cache cluster at a regular interval (pollInterval) to see if any new notifications are available.
So, if you update 10 times a key between two checks, you will get 10 notifications.

XMPP4R icq transport troubles

jid = Jabber::JID.new('....#jabber.ru')
j = Jabber::Client.new(jid)
j.connect
j.auth('12345')
if i trying to send message through transport it responds to me
SENDING:
<message to='2....3#icq.proc.ru' xmlns='jabber:client'><body>hi!</body></message>
=> nil
ruby-1.9.2-p290 :106 > RECEIVED:
<message from='2...3#icq.proc.ru' to='....#jabber.ru/38185266013242853702144' type='error'><error code='401' type='auth'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Error. You must log into the transport before sending messages.</text></error><body>hi!</body></message>
PROCESSING:
<message from='2....3#icq.proc.ru' to='do-not-replay.perekup.net#jabber.ru/38185266013242853702144' type='error' xmlns='jabber:client'><error code='401' type='auth'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Error. You must log into the transport before sending messages.</text></error><body>hi!</body></message> (Jabber::Message)
but:
iq = Jabber::Iq.new(:set)
query = Jabber::IqQuery.new
query.add_namespace('jabber:iq:auth')
query.add(REXML::Element.new('username').add_text("6...6"))
query.add(REXML::Element.new('password').add_text('F...1'))
iq.add(query)
iq.to = 'icq.proc.ru'
iq
j.send iq
SENDING:
<iq to='icq.proc.ru' type='set' xmlns='jabber:client'><query xmlns='jabber:iq:authenticate'><username>6....6</username><password>F....1</password></query></iq>
=> nil
ruby-1.9.2-p290 :105 > RECEIVED:
<iq from='icq.proc.ru' to='...#jabber.ru/38185266013242853702144' type='error'><error code='501' type='cancel'><feature-not-implemented/></error></iq>
PROCESSING:
<iq from='icq.proc.ru' to='...#jabber.ru/38185266013242853702144' type='error' xmlns='jabber:client'><error code='501' type='cancel'><feature-not-implemented/></error></iq> (Jabber::Iq)
i cant use Iq.new_authset_digest(jid, session_id, password) because i cant get session_id parameter
what am I doing wrong?
jid = Jabber::JID.new('user')
client = Jabber::Client.new(jid)
client.connect('54.187.67.96',5222)
client.auth('password')
client.send(Jabber::Presence.new.set_show(:chat).set_status('Rails!'))
puts "Hurray...!! Connected..!!"
# Send an Instant Message.
body = 'Hello from Rails'
to_jid = Jabber::JID.new('user')
message = Jabber::Message::new(to_jid, body).set_type(:normal).set_id('1')
client.send(message)

VBScript Converting XML Data to an ADODB RecordSet

I have a situation in which I need to dump XML into an ADODB Recordset in VBScript. My XML is in the form below. What I would like to do in my code is convert the XML into a recordset with AddressObject rows. The code below I tried but keep running into one DomDocument error after another. Can anyone please help me with a solution for this? I tried the code below in Notepad++ but still unable to get the right result.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<AuthorizationToken xmlns="http://www.avectra.com/2005/">
<Token>8d92d5ba-8b06-4464-9829-86eacac68e6c</Token>
</AuthorizationToken>
</soap:Header>
<soap:Body>
<GetQueryResponse xmlns="http://www.avectra.com/2005/">
<GetQueryResult>
<AddressObjects xsi:schemaLocation="http://www.avectra.com/2005/ Address.xsd" recordReturn="1">
<AddressObject>
<adr_key>2bbcd09f-89c7-4558-93bb-ce23e832ab94</adr_key>
<adr_line1>1447 Limerick Lane</adr_line1>
<adr_line2 xsi:nil="true" />
<adr_line3 xsi:nil="true" />
<adr_city>Canyon Lake</adr_city>
<adr_state>TX</adr_state>
<adr_post_code>78133</adr_post_code>
<adr_city_state_code>Canyon Lake, TX 78133</adr_city_state_code>
<adr_country>UNITED STATES</adr_country>
<adr_intl_province xsi:nil="true" />
<adr_county>Comal</adr_county>
<adr_bad_address_flag>0</adr_bad_address_flag>
<adr_no_validation_flag>0</adr_no_validation_flag>
<cst_id>001049008I</cst_id>
</AddressObject>
</AddressObjects>
</GetQueryResult>
</GetQueryResponse>
</soap:Body>
</soap:Envelope>
Public Function XMLToRecSet(Byref objXMLDoc2)
Dim rsReturn
Dim node
Dim attr ,attrs
Dim ObjXmlDoc
Set ObjXmlDoc = CreateObject("MSXML2.DOMDocument.3.0")
'Create/open the disconnected recordset
ObjXmlDoc = objXMLDoc2
Set node = objXMLDoc.selectSingleNode("//AddressObject/")
If( Not node Is Nothing) Then
Set rsReturn = CreateObject("ADODB.Recordset.6.0")
Set attrs = node.getAttributes()
for Each attr In attrs
rsReturn.Fields.Append attr.nodeName, adVarWChar, 255
Next
rsReturn.CursorLocation = adUseClient
rsReturn.CursorType = adOpenStatic
rsReturn.LockType = adLockOptimistic
rsReturn.Open
Set node = Nothing
'Loop/add rows
For Each node In objXMLDoc.selectNodes("//AddressObject/")
rsReturn.AddNew
For Each attr In node.Attributes
If(Not rsReturn(attr.nodeName)Is NOTHING) Then
rsReturn(attr.nodeName) = 1'attr.nodeValue
End if
Next
Next
If rsReturn.RecordCount <> 0 Then rsReturn.MoveFirst
'cExit:
End If
'Dispose DOM document
Set objXMLDoc = Nothing
Set XMLToRecSet = rsReturn
Set rsReturn = Nothing
End Function
Ado cannot handle an xml recordset. I think you need to use the old XML parser to get the data out. You could throw it into a db and then use ado to manipulate the data once its in a database.
Classic asp makes it very hard to work with Soap web services. I would strongly suggest coding this portion of your application in ASP.net ..

Resources