[SR-Users] Websocket transport and forward()

Andreas Granig agranig at sipwise.com
Thu Jun 27 14:03:10 CEST 2013


Hi,

On 06/27/2013 12:54 PM, Andreas Granig wrote:
> $du = $null;
> $fs = $null;
> forward();
>
> What I get is this error message:
>
> Jun 27 12:30:53 spce lb[12104]: ERROR: <core> [action.c:437]:
> do_action(): ERROR: do action: forward: bad uri transport 5
>
> Is there anything special I need to do? Does forward() maybe just not
> understand WS transport?


Alright, I think I found it. It seems like there is an issue in action.c 
where PROTO_WS and PROTO_WSS are not handled. This patch solves it for 
me, however it's just a proof of concept as I don't know enough of the 
core and WS implementation to understand the implications:

#+
diff --git a/action.c b/action.c
index e64cf81..58024a7 100644
--- a/action.c
+++ b/action.c
@@ -421,6 +421,8 @@ int do_action(struct run_act_ctx* h, struct action* 
a, struct sip_msg* msg)
                                                         /* no proto, 
try to get it from the dns */
                                                         break;
                                                 case PROTO_UDP:
+                                               case PROTO_WS:
+                                               case PROTO_WSS:
  #ifdef USE_TCP
                                                 case PROTO_TCP:
  #endif
#-

With that patch in place, I can set $fs to my local tcp socket, like

	$fs="tcp:192.168.51.133:5060";

and let $du point to the right destination, like

	$du="ws:192.168.51.1:1234";

and the request is forwarded correctly.

Any feedback on this?

Andreas



More information about the sr-users mailing list