General Category > Yate users hangout place
No Ringtone Custom Queue In Handle
ganapathi:
Hi
As am using custom handling for Queue Incoming module. But unable to playback the ringtone or custom music to the customer end.
Here you can find the code : https://paste.linux.community/view/7d30f87c
Also tried to attach once channel connected as well with mentioned below code.
--- Code: --- Message* m = new Message("chan.attach");
m->copyParam(msg, "id");
m->addParam("source", "tone/ring");
--- End code ---
But there is no ringtone on customer end.
marian:
Some notes:
- Delete message after dispatch: memory leak
- Don't install a handler for each call in queue: install a module global one
- msg.getParam(YSTRING("id"))->c_str(): not a good idea if the 'id' parameter is missing this will lead to segfault
What is wrong:
You execute queue chan to tone. This will play ring in queue chan
When you attach queue chan to incoming call you the tone chan will be destroyed: not connected
To play ring you must use chan.attach to set tone source in desired call leg (in queue chan).
You may use the API (CallEndpoint::connect()) instead of call.connect message. Usual procedure of executing a call in a driver:
QueueInChannel* c = new QueueInChannel(dest,msg,false);
c->initChan();
DO_SETUP (attach tone source) ...
if (SETUP_OK) {
CallEndpoint* ch = YOBJECT(CallEndpoint,msg.userData());
if (ch && c->connect(ch,msg.getValue(YSTRING("reason")))) {
c->callConnect(msg);
msg.setParam("peerid",c->id());
msg.setParam("targetid",c->id());
c->deref();
return true;
}
}
CLEANUP ....
c->deref();
return false;
ganapathi:
Thanks. Now Understand.
And here are few doubt.
* How do i call QueueInChannel destructor when Customer call hangup to emit chan.hangup and clean up the qin channel. Where am tracking chan.disconnected and dispatching the chan.hangup forcefully, eventhough qin channel not cleared.
* You are trying to say Delete the Message after dispatch of QueueInChannel or every message such as call.execute/chan.connect etc. If then how do delete the message ?. i didn't find any procedure to delete message in source and perfect time to delete message.
Instead of msg.getParam(YSTRING("id"))->c_str(), msg.getValue("id") is fine. Or i need to validate if id is exist or not to proceed further to avoid segfault.
ganapathi:
--- Quote from: marian on October 23, 2018, 12:02:19 AM ---- Don't install a handler for each call in queue: install a module global one
--- End quote ---
Using it only to pass the variable value where i am not sure how to pass variable and access it accordingly through-out the messages. And it would lead memory leak as well ?.
marian:
I don't understand.
If you are speaking about matching call leg id you may always retrieve a channel in driver list. See Driver class documentation.
There is no memory leak in message handlers: the Engine will remove them on shutdown.
You may track them (keep a pointer) and remove from Engine when necessary.
Navigation
[0] Message Index
[#] Next page
Go to full version