public async Task CanGetSipEngineStatus() { await _testClient.ConnectAsync(RoleType.Global, CancellationToken.None); _server.AckConnect(); var result = _testClient.SendMessageAsync(new EngineStatusSip(), CancellationToken.None); string id = null; bool Validate(string message) { Assert.StartsWith("%%>message:", message); id = message.Substring(11, message.IndexOf(':', 11) - 11); Assert.Contains(":engine.status:", message); Assert.Contains(":module=sip", message); return(true); } _server.ReplyToMessage(Validate, () => $"%%<message:{id}:false:engine.status" + ":name=sip,type=varchans,format=Status|Address|Peer;routed=386,routing=0,total=386,chans=3,transactions=0;sip/384=answered|172.24.24.4%z5060|ExtModule,sip/385=answered|172.24.24.3%z5060|ExtModule,sip/386=answered|172.24.24.6%z5060|ExtModule%M%J" + ":module=sip" + ":handlers=engine%z90,cdrbuild%z100,moh%z100,callgen%z100,isaccodec%z100,cdrcombine%z100,mysqldb%z110,openssl%z110,mux%z110,wave%z110,callfork%z110,tonedetect%z110,stun%z110,tone%z110,dumb%z110,yrtp%z110,conf%z110,extmodule%z110,regexroute%z110,sip%z110,pbx%z110,queues%z110,register%z110,monitoring%z110,park%z110,queuesnotify%z110,snmpagent%z110"); var response = await result; Assert.Equal(3, response.Details.Count); var last = response.Details.Last(); Assert.Equal("answered", last["Status"]); Assert.Equal("172.24.24.6:5060", last["Address"]); Assert.Equal("ExtModule", last["Peer"]); }
public async Task CanSendMessage() { await CanConnect(); var response = await _client.SendMessageAsync("zwerg.on", "ok", CancellationToken.None); Assert.Equal("ok", response.Result); Assert.True(response.Handled); }