<commit_before>package dptools

import (
	"github.com/bit4bit/glivo"
	"bytes"
)

//Execute Bridge and returns the events hangup for the ALeg and BLeg of the call
func (dptools *DPTools) Bridge(endpoint string) (aleg *glivo.Event, bleg *glivo.Event) {
	var send bytes.Buffer

	send.WriteString(endpoint)


	
	wait_bridge := dptools.call.WaitExecute("bridge", map[string]string{
		"Event-Name": "CHANNEL_EXECUTE_COMPLETE",
		"Application": "bridge",
	})
	dptools.call.Execute("bridge", send.String(), true)
	<-wait_bridge


	wait_action := dptools.call.OnceEventHandle("bridge_action", func(res chan interface{}) glivo.HandlerEvent {
		return glivo.NewWaitAnyEventHandle(res,
			[]map[string]string{
				{"Event-Name": "CHANNEL_UNBRIDGE"},
				{"Event-Name": "CHANNEL_HANGUP"},
			})
	})

	action := (<-wait_action).(glivo.Event)


	switch action.Content["Event-Name"] {
		//hangup BLeg
	case "CHANNEL_UNBRIDGE":
		bleg = &action
		//wait hangup ALeg
		action_aleg := (<-wait_bridge).(glivo.Event)
		aleg = &action_aleg
		//hangup trying bridge
		//hangup ALeg
	case "CHANNEL_HANGUP":
		aleg = &action
	}
	
	return aleg, bleg
}
<commit_msg>corr orden de coleccion de eventos en bridge<commit_after>package dptools

import (
	"github.com/bit4bit/glivo"
	"bytes"
)

//Execute Bridge and returns the events hangup for the ALeg and BLeg of the call
func (dptools *DPTools) Bridge(endpoint string) (aleg *glivo.Event, bleg *glivo.Event) {
	var send bytes.Buffer

	send.WriteString(endpoint)


	
	wait_bridge := dptools.call.WaitExecute("bridge", map[string]string{
		"Event-Name": "CHANNEL_EXECUTE",
		"Application": "bridge",
	})
	dptools.call.Execute("bridge", send.String(), true)
	<-wait_bridge


	wait_action := dptools.call.OnceEventHandle("bridge_action", func(res chan interface{}) glivo.HandlerEvent {
		return glivo.NewWaitAnyEventHandle(res,
			[]map[string]string{
				{"Event-Name": "CHANNEL_UNBRIDGE"},
				{"Event-Name": "CHANNEL_HANGUP"},
				{"Event-Name": "CHANNEL_EXECUTE_COMPLETE"},
			})
	})

	action := (<-wait_action).(glivo.Event)


	switch action.Content["Event-Name"] {
		//hangup BLeg
	case "CHANNEL_UNBRIDGE":
		bleg = &action
		//wait hangup ALeg
		action_aleg := (<-wait_bridge).(glivo.Event)
		aleg = &action_aleg
		//hangup trying bridge
		//hangup ALeg
	case "CHANNEL_HANGUP":
		aleg = &action
	case "CHANNEL_EXECUTE_COMPLETE":
		aleg = &action
	}
	
	return aleg, bleg
}

{'fraction_non_alphanumeric': 0.14267834793491865, 'fraction_numerical': 0.0008343763037129745, 'mean_word_length': 4.4874141876430205, 'pattern_counts': {'":': 14, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2048839', 'n_tokens_mistral': 937, 'n_tokens_neox': 863, 'n_words': 185}