@@ -485,13 +485,13 @@ private void OnGetModelResponse(RESTConnector.Request req, RESTConnector.Respons
485
485
/// This callback object is used by the Recognize() and StartListening() methods.
486
486
/// </summary>
487
487
/// <param name="results">The ResultList object containing the results.</param>
488
- public delegate void OnRecognize ( SpeechRecognitionEvent results ) ;
488
+ public delegate void OnRecognize ( SpeechRecognitionEvent results , Dictionary < string , object > customData = null ) ;
489
489
490
490
/// <summary>
491
491
/// This callback object is used by the RecognizeSpeaker() method.
492
492
/// </summary>
493
493
/// <param name="speakerRecognitionEvent">Array of speaker label results.</param>
494
- public delegate void OnRecognizeSpeaker ( SpeakerRecognitionEvent speakerRecognitionEvent ) ;
494
+ public delegate void OnRecognizeSpeaker ( SpeakerRecognitionEvent speakerRecognitionEvent , Dictionary < string , object > customData = null ) ;
495
495
496
496
/// <summary>
497
497
/// This starts the service listening and it will invoke the callback for any recognized speech.
@@ -510,7 +510,7 @@ public bool StartListening(OnRecognize callback, OnRecognizeSpeaker speakerLabel
510
510
if ( ! CreateListenConnector ( ) )
511
511
return false ;
512
512
513
- Dictionary < string , string > customHeaders = null ;
513
+ Dictionary < string , string > customHeaders = new Dictionary < string , string > ( ) ;
514
514
if ( customData . ContainsKey ( Constants . String . CUSTOM_REQUEST_HEADERS ) )
515
515
{
516
516
foreach ( KeyValuePair < string , string > kvp in customData [ Constants . String . CUSTOM_REQUEST_HEADERS ] as Dictionary < string , string > )
@@ -756,7 +756,8 @@ private void OnListenMessage(WSConnector.Message msg)
756
756
if ( msg is WSConnector . TextMessage )
757
757
{
758
758
WSConnector . TextMessage tm = ( WSConnector . TextMessage ) msg ;
759
-
759
+ Dictionary < string , object > customData = new Dictionary < string , object > ( ) ;
760
+ customData . Add ( "json" , tm . Text ) ;
760
761
IDictionary json = Json . Deserialize ( tm . Text ) as IDictionary ;
761
762
if ( json != null )
762
763
{
@@ -771,7 +772,7 @@ private void OnListenMessage(WSConnector.Message msg)
771
772
// SendStart();
772
773
773
774
if ( _listenCallback != null )
774
- _listenCallback ( results ) ;
775
+ _listenCallback ( results , customData ) ;
775
776
else
776
777
StopListening ( ) ; // automatically stop listening if our callback is destroyed.
777
778
}
0 commit comments