Hi Jonathan,

A Merry Christmas to you too !

I found a small mistake in the original patch I sent you. Please revert that one and use this new patch (see attachment). Let me know if it does the trick.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 22.12.2016 13:58, Jonathan Hunter wrote:

Hi Bogdan,


Merry Christmas to you and the mailing list!


I am testing the real queue position, and with one call in progress, and then 2 subsequent calls, both of which hit the hold music loop, I unfortunately dont see the position value increment, it remains at cc_pos=0 for all the calls, this is with just one queue defined to keep things very simple.


Please let me know what debug or information you require, here are some outputs;




opensipsctl fifo cc_list_calls
Call:: 255.0 Ref=2 State=queued Call Time=2 Flow=Cust1
Call:: 884.0 Ref=2 State=queued Call Time=51 Flow=Cust1
Call:: 344.0 Ref=1 State=toagent Call Time=70 Flow=Cust1 Agent=2000

opensipsctl fifo cc_list_agents
Agent:: 2000 Ref=1 Loged in=YES State=incall

opensipsctl fifo cc_list_flows
Flow:: Cust1 Avg Call Duration=199 Processed Calls=3 Logged Agents=1 Ongoing Calls=3 Ref=3

opensipsctl fifo cc_list_queue
Call:: 0 Waiting for=114 ETW=0
        Flow:: Cust1 Priority=256 Skill=custcare
Call:: 1 Waiting for=65 ETW=199
        Flow:: Cust1 Priority=256 Skill=custcare

Many thanks

Jon




------------------------------------------------------------------------
*From:* Bogdan-Andrei Iancu <[email protected]>
*Sent:* 07 November 2016 20:41
*To:* Jonathan Hunter; OpenSIPS users mailling list
*Subject:* Re: [OpenSIPS-Users] opensips 2.1 call_center queue position
Hi Jonathan,

I was not able to test it with a real queue, so let me know if it really does the job (in terms of reporting the real position in the queue).

Some questions:
1) currently I add that value only when sending to the queue / MOH - do you foresee any need to be added for other announcements like for welcome ?

2) will it be useful to add the ETW (estimate time to wait) ? is it useful ?

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com







diff --git a/modules/call_center/cc_data.c b/modules/call_center/cc_data.c
index 45112e8..55af6ec 100755
--- a/modules/call_center/cc_data.c
+++ b/modules/call_center/cc_data.c
@@ -915,7 +915,7 @@ void print_queue(struct cc_data *data)
 }
 
 
-void cc_queue_push_call(struct cc_data *data, struct cc_call *call, int top)
+int cc_queue_push_call(struct cc_data *data, struct cc_call *call, int top)
 {
 	struct cc_call *call_it;
 	int n = 0;
@@ -971,6 +971,8 @@ void cc_queue_push_call(struct cc_data *data, struct cc_call *call, int top)
 
 	if (call->queue_start==0)
 		call->queue_start = get_ticks();
+
+	return data->queue.calls_no-1-n;
 }
 
 
diff --git a/modules/call_center/cc_data.h b/modules/call_center/cc_data.h
index e2cf62c..14ebf37 100755
--- a/modules/call_center/cc_data.h
+++ b/modules/call_center/cc_data.h
@@ -227,7 +227,7 @@ void clean_cc_old_data(struct cc_data *data);
 
 void clean_cc_unref_data(struct cc_data *data);
 
-void cc_queue_push_call(struct cc_data *data, struct cc_call *call, int top);
+int cc_queue_push_call(struct cc_data *data, struct cc_call *call, int top);
 
 struct cc_call *cc_queue_pop_call_for_agent(struct cc_data *data,
 		struct cc_agent *agent);
diff --git a/modules/call_center/cc_queue.c b/modules/call_center/cc_queue.c
index 757bcf3..3956eb4 100644
--- a/modules/call_center/cc_queue.c
+++ b/modules/call_center/cc_queue.c
@@ -24,6 +24,7 @@
  *  2014-03-17 initial version (bogdan)
  */
 
+#include "../../ut.h"
 #include "cc_queue.h"
 
 extern stat_var *stg_terminated_calls;
@@ -40,6 +41,7 @@ int cc_call_state_machine(struct cc_data *data, struct cc_call *call,
 	struct cc_agent *agent;
 	str *out = NULL;
 	int state =0;
+	int pos = -1;
 
 	switch (call->state) {
 		case CC_CALL_NONE:
@@ -81,7 +83,7 @@ int cc_call_state_machine(struct cc_data *data, struct cc_call *call,
 					break;
 				}
 				/* add it to queue */
-				cc_queue_push_call( data, call, 0);
+				pos = cc_queue_push_call( data, call, 0);
 			}
 			break;
 		case CC_CALL_TOAGENT:
@@ -94,10 +96,20 @@ int cc_call_state_machine(struct cc_data *data, struct cc_call *call,
 	}
 
 	if (out) {
-		leg->s = (char*)pkg_malloc( out->len );
+		int l=0;
+		char *s;
+		if (pos>=0)
+			s=int2str((unsigned long)pos, &l);
+		leg->s = (char*)pkg_malloc( out->len + ((pos<0)?0:(8+l)) );
 		if (leg->s) {
 			leg->len = out->len;
 			memcpy(leg->s,out->s,out->len);
+			if (pos>=0) {
+				memcpy(leg->s+leg->len, ";cc_pos=",8);
+				leg->len += 8;
+				memcpy(leg->s+leg->len, s, l);
+				leg->len += l;
+			}
 			call->prev_state = call->state;
 			call->state = state;
 			return 0;
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to